Simple question.. just can\'t get the result set in the order I need :p
I have a table \"categories\"
id | name | parent 1 apple 0
This would work, but not recursively.
SELECT b.* FROM categories a RIGHT JOIN categories b ON b.parent = a.id ORDER BY COALESCE(a.name, b.name), b.name