請教SQL大蝦們一個比較不太難的問題:

來源: 小謀 2009-07-29 20:25:37 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (324 bytes)
我要從數據庫裏取數據,有著麽一段code:
...
where
condition1 and
condition2 and
a.variable1 = 'ABC' and
condition4 and
condition5;
quit;

但是總說有錯,說在用where的時候,應該在‘,’ 和 ‘and' 之間有個 “)”之類的東西。可我的code裏根本沒有逗號 ’,'

請講講這是怎麽回事, 萬分感謝。

所有跟帖: 

有時候係統提示doesnt make sense, 你吧你的code和係統提示原汁原味的貼上來 -撅著挺好- 給 撅著挺好 發送悄悄話 (0 bytes) () 07/29/2009 postreply 20:41:44

那得等明天了,太晚了。 -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 07/29/2009 postreply 20:58:37

回複:請教SQL大蝦們一個比較不太難的問題: -susan_6_5- 給 susan_6_5 發送悄悄話 (33 bytes) () 07/29/2009 postreply 21:14:22

我覺得是那個a.var1='ABC' and ...出問題了,我也試了另一個寫法: -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (54 bytes) () 07/29/2009 postreply 21:25:32

碰到這種情況就用排除法,從第一個condition開始 -撅著挺好- 給 撅著挺好 發送悄悄話 (48 bytes) () 07/29/2009 postreply 21:55:29

對,排除法對付這個case很正。一個個加上去or 一個個去掉。 -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 07/30/2009 postreply 07:41:58

google error code and message -goyo- 給 goyo 發送悄悄話 (43 bytes) () 07/30/2009 postreply 08:20:19

check also the FROM and SELECT -goyo- 給 goyo 發送悄悄話 (34 bytes) () 07/30/2009 postreply 08:22:51

我今天上班找到那個多出來的逗號了. -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 07/30/2009 postreply 20:47:25

請您先登陸,再發跟帖!

發現Adblock插件

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

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

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

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