我需要comp_gid作为强制性剩余字段,如holder1_name,holder1_fh_name,holder1_pan_no可能包含值或者它将为null
SELECT *
FROM sta.sta_trn_tfolio
where (holder1_name='AMAR' or holder1_fh_name='' or holder1_pan_no='')
AND comp_gid='1' ;
但我只得到comp_gid条件。如果有人知道,请帮助我
答案 0 :(得分:0)
您应该添加对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' ;