Search code examples
mysqlrelevance

MySQL query ordering off by 1?


The query:

select title from gamelist where match (title) against ('super mario luigi');

Returns:

+-----------------------------------+
| title                             |
+-----------------------------------+
| Super Mario and Luigi             |
| Super Mario Luigi: Inside Story   |
| New Super Mario Bros.             |
| Mario and Luigi: Partners In Time |
| Luigi: Mansion                    |
+-----------------------------------+
5 rows in set (0.00 sec)

Super Mario Luigi: Inside Story is supposed to come before Super Mario and Luigi. What am I doing wrong?

Thanks!


Solution

  • You are not specifying how the results are supposed to be ordered. The returned result order is undefined in that case. Add an explicit ORDER BY, in your case (if I understand it right)

    select title from gamelist where match (title) against ('super mario luigi') 
     order by title DESC;