我需要comp_gid像holder1_name,holder1_fh_name強制其餘字段&和條件,holder1_pan_no可能包含值或將是空如何使用多個或在MySQL
SELECT *
FROM sta.sta_trn_tfolio
where (holder1_name='AMAR' or holder1_fh_name='' or holder1_pan_no='')
AND comp_gid='1' ;
,但我只得到comp_gid條件。幫助我,如果有人知道
我需要comp_gid像holder1_name,holder1_fh_name強制其餘字段&和條件,holder1_pan_no可能包含值或將是空如何使用多個或在MySQL
SELECT *
FROM sta.sta_trn_tfolio
where (holder1_name='AMAR' or holder1_fh_name='' or holder1_pan_no='')
AND comp_gid='1' ;
,但我只得到comp_gid條件。幫助我,如果有人知道
您應該NULL補充檢查:
SELECT * FROM sta.sta_trn_tfolio
where
(holder1_name IS NULL OR
holder1_fh_name IS NULL OR
holder1_pan_no IS NULL OR
holder1_name='AMAR' or
holder1_fh_name='' or
holder1_pan_no='')
AND comp_gid='1' ;
工作不相同的結果來 –
對不起,沒有足夠的細心(更新答案),但點是相同的:你應該檢查null的可空值。 NULL = <
顯示錶結構及數據 –