樂透SQL 語法問題 |
尚未結案
|
ticky
初階會員 發表:35 回覆:69 積分:25 註冊:2002-11-12 發送簡訊給我 |
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
Hi ticky,
if 投注與選號為 1 => N select h.id, count(*) from 選號檔 l, 投注檔 h where h.id = l.id and l.號碼 in (2,4,6,8,10,12) having count(*) = 5 if 投注與選號為 1 => 1 (SQL Server) select x.id, x.n1, x.n2, x.n3, x.n4, x.n5, x.n6, (nn1 nn2 nn3 nn4 nn5 nn6) bingo from (select t.id, t.n1, t.n2, t.n3, t.n4, t.n5, t.n6, case when n1 in (2,4,6,8,10,12) then 1 else 0 end as nn1, case when n2 in (2,4,6,8,10,12) then 1 else 0 end as nn2, case when n3 in (2,4,6,8,10,12) then 1 else 0 end as nn3, case when n4 in (2,4,6,8,10,12) then 1 else 0 end as nn4, case when n5 in (2,4,6,8,10,12) then 1 else 0 end as nn5, case when n6 in (2,4,6,8,10,12) then 1 else 0 end as nn6 from table1 t) x where (nn1 nn2 nn3 nn4 nn5 nn6) = 5---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |