Say I have the following table:
ID Author
---------------------
1 Bill
2 Joe
3 Bill and Joe
4 Bill
And I want a result set that would come from:
SELECT id FROM table WHERE Author LIKE '%Bill%' OR Author = 'Bill'
How could I order it so that the rows matched with equality are the first rows returned and the like matches comes after? e.g. The query would return 1,4,3. I am using MySQL but would take answers in any DB.
You can probably just do
ORDER BY Author != 'Bill'as well – Not sure about ordering by boolean expressions in MySQL.