Order hybrid mixed mysql search result in one query?
- by Fredrik
This problem is easy fixed clientside. But for performance I want to do it directly to the database.
LIST a
+------+-------+-------+
| name | score | cre |
+------+-------+-------+
| Abe | 3 | 1 |
| Zoe | 5 | 2 |
| Mye | 1 | 3 |
| Joe | 3 | 4 |
Want to retrieve a joined hybrid result without duplications.
Zoe (1st higest score)
Joe (1st last submitted)
Abe (2nd highest score)
Mye (2nd last submitted)
...
Clientside i take each search by itself and step though them.
but on 100.000+ its getting awkward. To be able to use the LIMIT function would ease things up a lot!
SELECT name FROM a ORDER BY score DESC, cre DESC;
SELECT name FROM a ORDER BY cre DESC, score DESC;