Please help in SQL code and Thank you

來源: luck2010 2011-01-08 16:28:50 [] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (335 bytes)

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

請您先登陸,再發跟帖!

發現Adblock插件

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

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

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

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