日期:2014-05-16 浏览次数:20874 次
mysql> select * from tend; +------+-----+------+------+------------+-------+ | id | cnt | god | aid | t_tim | t_stu | +------+-----+------+------+------------+-------+ | 230 | 1 | 422 | 243 | 1263969843 | 6 | | 301 | 1 | 1630 | 1089 | 1263994231 | 1 | | 1024 | 1 | 1700 | 1168 | 1264424112 | 10 | | 1156 | 1 | 0 | 0 | 1264503945 | 5 | | 1241 | 1 | 800 | 536 | 1264562344 | 1 | | 1487 | 1 | 471 | 313 | 1264755894 | 9 | | 1497 | 1 | 607 | 446 | 1264757909 | 1 | | 1521 | 2 | 384 | 229 | 1264765911 | 8 | | 1527 | 1 | 384 | 229 | 1264767574 | 6 | | 1541 | 1 | 518 | 337 | 1264770033 | 3 | | 1798 | 1 | 359 | 175 | 1265256419 | 1 | | 1849 | 1 | 359 | 175 | 1265620065 | 6 | | 1882 | 1 | 471 | 313 | 1266670635 | 7 | | 1883 | 1 | 432 | 265 | 1266670796 | 4 | | 1912 | 1 | 1266 | 826 | 1266756302 | 3 | | 1956 | 1 | 516 | 325 | 1266831684 | 6 | | 1971 | 1 | 0 | 0 | 1266903628 | 1 | +------+-----+------+------+------------+-------+ 17 rows in set (0.00 sec) mysql> select * -> from tend -> order by t_stu=1 desc,t_tim desc; +------+-----+------+------+------------+-------+ | id | cnt | god | aid | t_tim | t_stu | +------+-----+------+------+------------+-------+ | 1971 | 1 | 0 | 0 | 1266903628 | 1 | | 1798 | 1 | 359 | 175 | 1265256419 | 1 | | 1497 | 1 | 607 | 446 | 1264757909 | 1 | | 1241 | 1 | 800 | 536 | 1264562344 | 1 | | 301 | 1 | 1630 | 1089 | 1263994231 | 1 | | 1956 | 1 | 516 | 325 | 1266831684 | 6 | | 1912 | 1 | 1266 | 826 | 1266756302 | 3 | | 1883 | 1 | 432 | 265 | 1266670796 | 4 | | 1882 | 1 | 471 | 313 | 1266670635 | 7 | | 1849 | 1 | 359 | 175 | 1265620065 | 6 | | 1541 | 1 | 518 | 337 | 1264770033 | 3 | | 1527 | 1 | 384 | 229 | 1264767574 | 6 | | 1521 | 2 | 384 | 229 | 1264765911 | 8 | | 1487 | 1 | 471 | 313 | 1264755894 | 9 | | 1156 | 1 | 0 | 0 | 1264503945 | 5 | | 1024 | 1 | 1700 | 1168 | 1264424112 | 10 | | 230 | 1 | 422 | 243 | 1263969843 | 6 | +------+-----+------+------+------------+-------+ 17 rows in set (0.06 sec) mysql>