Please help in SQL code and Thank you

Please help to point out the error(s) in the SQL code:

select
c.cust_nam,
count s.qty_sold
from
customers c and
sales s
where
c.cust_id = s.cust_id,
s.sale_dat >= ‘20100101’,
s.sale_dat <= ‘20101231’
group by
c.cust_nam

所有跟帖: 

google 'SQL Join' -胡说之- 给 胡说之 发送悄悄话 胡说之 的博客首页 (189 bytes) () 01/08/2011 postreply 17:22:20

后面的条件也不能用逗号,用 AND/OR -胡跟之- 给 胡跟之 发送悄悄话 (0 bytes) () 01/08/2011 postreply 17:45:19

跟得好,这才名副其实 -胡说之- 给 胡说之 发送悄悄话 胡说之 的博客首页 (0 bytes) () 01/08/2011 postreply 17:48:59

错了,这个可不是胡跟:) -胡跟之- 给 胡跟之 发送悄悄话 (0 bytes) () 01/08/2011 postreply 17:52:30

还是错了,老师也不是胡说:D -胡跟之- 给 胡跟之 发送悄悄话 (21 bytes) () 01/08/2011 postreply 18:05:22

Group by customer name? Doesn't make sense -世界无童话- 给 世界无童话 发送悄悄话 世界无童话 的博客首页 (0 bytes) () 01/08/2011 postreply 19:11:47

语法上没问题,如果是公司名也make sense -胡跟之- 给 胡跟之 发送悄悄话 (0 bytes) () 01/08/2011 postreply 19:49:25

You can write like this -oops_yz- 给 oops_yz 发送悄悄话 (394 bytes) () 01/08/2011 postreply 20:49:17

回复:Please help in SQL code and Thank you -未知未觉- 给 未知未觉 发送悄悄话 未知未觉 的博客首页 (980 bytes) () 01/08/2011 postreply 22:23:49

This is correct! -平安是福mtl- 给 平安是福mtl 发送悄悄话 平安是福mtl 的博客首页 (0 bytes) () 01/09/2011 postreply 08:53:33

这个答案真标准,工整明了。:) -八音涧- 给 八音涧 发送悄悄话 八音涧 的博客首页 (0 bytes) () 01/09/2011 postreply 18:22:43

Thank 胡说之, 胡跟之, 世界无童话, oops_yz, 未知未觉, 平安是福mtl, 八音涧 -luck2010- 给 luck2010 发送悄悄话 (0 bytes) () 01/09/2011 postreply 21:01:17

how about this: -greentree2010- 给 greentree2010 发送悄悄话 (285 bytes) () 01/09/2011 postreply 22:03:27

请您先登陆,再发跟帖!