回复:Please help in SQL code and Thank you

回答: Please help in SQL code and Thank youluck20102011-01-08 16:28:50

My version:

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

errors are

1. Wrong: count s.qty_sold

Correct: count(s.qty_sold)

2. Wrong: from customers c and sales s

Correct: "from customers c, sales s

3. Wrong: c.cust_id = s.cust_id,
s.sale_dat >= ‘20100101’,
s.sale_dat <= ‘20101231’

Correct: c.cust_id = s.cust_id and 
s.sale_dat >= ‘20100101’and
s.sale_dat <= ‘20101231’

所有跟帖: 

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

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

请您先登陆,再发跟帖!