Sort ordering for Mysql and Postgres