Usually when ordering an increase in a field, you first get NULL values, and then more interesting values. Often you need NULL values. In MySQL, you can do this with:
SELECT * FROM people ORDER BY ISNULL(name), name;
However, I use Grails with Hibernate criteria, and I have absolutely no idea how to do this. Is it even supported? Is there a way to order a custom SQL expression? I would really like to rewrite all my criteria in plain SQL so that it is sorted correctly.
source
share