Cassi has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,

Are some you experienced with mysql I'm with a problem trying to order mysql results by relevance

I'm trying the code:
select `from`,group_concat(text) as con from `database` where match text against ('windows xp')group by `from` order by con desc

But for now the relevance is terrible, and I'm not able to find a solution, tried subqueries with no sucess.
I must be doing something really wrong here :)
As you can see, I need to group the results on "from" but I need the relevance based on the text, some idea?

Replies are listed 'Best First'.
Re: mysql order and group_concat
by jeffa (Bishop) on Nov 20, 2008 at 17:23 UTC

    This is completely off-topic so don't be surprise if your question is reaped, but (if i even understand your question correctly) perhaps you can try using HAVING instead of WHERE?

    select `from`, group_concat(text) as con from `database` group by `from` having match text against ('windows xp') order by con desc

    I must admit however that I really don't understand how match text against ('windows xp') works. :/

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      thanks for the reply but it actually don't work, I'm doing right now with 2 mysql calls :(. The first one select unique(from) and return the correct relevance, and the second one is doing the group_concat, It's not what a finally solution, I believe that must exist some way to make it all with only one mysql call.