table名為ball,欄位有ba1、ba2、ba3、ba4、ba5、ba6
我想查 球號 22,33,44,這三個號碼的球,同時出現在同一期,該如何下指令呢
目前我只能做有22,33,44任一號出來就顯示的指令,如下:
SELECT * FROM ball WHERE
(ba1 in ('22','33','44') OR
ba2 in ('22','33','44') OR
ba3 in ('22','33','44') OR
ba4 in ('22','33','44') OR
ba5 in ('22','33','44') OR
ba6 in ('22','33','44'))
我有試過把上面OR改成AND
結果也不行
請各位前輩指點一二
謝謝
SELECT * FROM ball WHERE
(
(ba1 in ('22','33','44')) +
(ba2 in ('22','33','44')) +
(ba3 in ('22','33','44')) +
(ba4 in ('22','33','44')) +
(ba5 in ('22','33','44')) +
(ba6 in ('22','33','44'))
) =3