請問!DBASE的SQL語法?? |
缺席
|
oll24286
一般會員 ![]() ![]() 發表:7 回覆:7 積分:2 註冊:2004-11-30 發送簡訊給我 |
下面是MSSQL的語法,那請問DBASE的語法要怎麼下,才會有相同的結果..
SELECT
COUNT(CASE D.InsuSource_Type WHEN '01' THEN M.Insu_No1 ELSE NULL END) AS Count1
,COUNT(CASE D.InsuSource_Type WHEN '02' THEN M.Insu_No1 ELSE NULL END) AS Count2
,COUNT(CASE D.InsuSource_Type WHEN '03' THEN M.Insu_No1 ELSE NULL END) AS Count3
,COUNT(CASE D.InsuSource_Type WHEN '04' THEN M.Insu_No1 ELSE NULL END) AS Count4
,COUNT(CASE D.InsuSource_Type WHEN '05' THEN M.Insu_No1 ELSE NULL END) AS Count5
,COUNT(CASE D.InsuSource_Type WHEN '06' THEN M.Insu_No1 ELSE NULL END) AS Count6
,COUNT(CASE D.InsuSource_Type WHEN '07' THEN M.Insu_No1 ELSE NULL END) AS Count7
FROM InsuInvo AS M LEFT JOIN InsuSource AS D ON M.InsuSource_No = D.InsuSource_No 幫忙指點一下...TKS!!!
|
P.D.
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
引言: 下面是MSSQL的語法,那請問DBASE的語法要怎麼下,才會有相同的結果.. SELECT COUNT(CASE D.InsuSource_Type WHEN '01' THEN M.Insu_No1 ELSE NULL END) AS Count1 ,COUNT(CASE D.InsuSource_Type WHEN '02' THEN M.Insu_No1 ELSE NULL END) AS Count2 ,COUNT(CASE D.InsuSource_Type WHEN '03' THEN M.Insu_No1 ELSE NULL END) AS Count3 ,COUNT(CASE D.InsuSource_Type WHEN '04' THEN M.Insu_No1 ELSE NULL END) AS Count4 ,COUNT(CASE D.InsuSource_Type WHEN '05' THEN M.Insu_No1 ELSE NULL END) AS Count5 ,COUNT(CASE D.InsuSource_Type WHEN '06' THEN M.Insu_No1 ELSE NULL END) AS Count6 ,COUNT(CASE D.InsuSource_Type WHEN '07' THEN M.Insu_No1 ELSE NULL END) AS Count7 FROM InsuInvo AS M LEFT JOIN InsuSource AS D ON M.InsuSource_No = D.InsuSource_No 幫忙指點一下...TKS!!!Dbase 並沒有支援任何sql語法, 透過 BDE的TQuery, TTable 或及其任何支援 Dbase 的任何TQuery型式的Table介面可以下sql, 不過支援 case 的用法, 很多資料庫都不提供, 如果不在意語法的正規化及 精簡, 不妨考慮把上面這些拆成數個Query, 例如 Count(M.Insu_no1) As Count1 where D.InsuSource_type='01' Count(M.Insu_no1) As Count2 where D.InsuSource_type='02' ... 一樣可以得到你要的結果 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |