select if(updated_at>created_at,updated_at,created_at) as temp, id from chats order by temp mysql 會先正常列出select出來的row, 再這個暫時表order by 這個自創欄位