开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜