作者shadowjohn (3WA问题解决专家)
看板PHP
标题Re: [请益] 资料库日期排序错误(date)
时间Tue Aug 31 14:29:19 2010
localtime 是保留字,请记得用 ` ` 框起来
mysql> select * from `questions` order by `localtime`;
+------+------------+
| id | localtime |
+------+------------+
| 1 | 2009-11-03 |
| 5 | 2009-11-03 |
| 3 | 2010-01-05 |
| 7 | 2010-02-08 |
| 2 | 2010-02-09 |
| 6 | 2010-02-09 |
| 4 | 2010-02-10 |
+------+------------+
7 rows in set (0.00 sec)
mysql> select * from questions order by localtime;
+------+------------+
| id | localtime |
+------+------------+
| 1 | 2009-11-03 |
| 5 | 2009-11-03 |
| 3 | 2010-01-05 |
| 4 | 2010-02-10 |
| 2 | 2010-02-09 |
| 7 | 2010-02-08 |
| 6 | 2010-02-09 |
+------+------------+
7 rows in set (0.00 sec)
mysql>
--
3WA训练家的工作室
宗旨:诸葛单中,谢谢
个人布弱格 网址:
http://3wa.tw
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.32.9.79