开发者

What is the problem with this mysql query

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);

it gave me this error

    ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual that corresponds to your MySQL serve开发者_运维问答r 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

Please let me know where is the problem


No space allow for count (*)

count(*)


The issue is with the space after COUNT. Do not use a space here. See this MySQL bug: Bug #2664 An extra space after Count in a Count(distinct... statement fails

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜