How to use order by with distinct in mysql?