Order posts by Last comment date and the created data
I have Posts table with two attributes "last_comment" and "created" and I save the unix time stamp date , I want to order the posts by the created date and also the last_comment Des开发者_Go百科cending .
select * from table order by last_comment desc, created
select * from table
order by created, last_comment desc
Here is how to sort rows in MySql
http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html
SELECT *
FROM table
ORDER BY created DESC, last_comment DESC
精彩评论