回複:Please help in SQL code and Thank you

來源: 未知未覺 2011-01-08 22:23:49 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (980 bytes)
回答: 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

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”