这个mysql查询有什么问题

时间:2010-12-29 13:32:47

标签: mysql

select count (*) from sales_order where date_format
(created_at,'%Y-%m-%d') >= 
'2009-11-02' and date_format(created_at,'%Y-%m-%d')
 <= '2010-12-08' and customer_id in 
(14,1113,1115,1117,1132,1312,1345);

它给了我这个错误

    ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual that corresponds to your MySQL server version for 
the right syntax to use near '*) from sales_order where 
date_format(created_at,'%Y-%m-%d') >= '2009-11-02' and' at line 1

请告诉我问题在哪里

2 个答案:

答案 0 :(得分:3)

count (*)

不允许空格
count(*)

答案 1 :(得分:1)

问题在于COUNT之后的空格。不要在这里使用空间。请参阅此MySQL错误:Bug #2664 An extra space after Count in a Count(distinct... statement fails