A表中有字段b
if 参数c不等于NULL时 取出下列集合
select b from a where b = 参数c
if 参数c等于NULL时 取出下列集合
select b from a where b IS NOT NULL
如何把这两个写成一个SQL呀?
if 参数c不等于NULL时 取出下列集合
select b from a where b = 参数c
if 参数c等于NULL时 取出下列集合
select b from a where b IS NOT NULL
如何把这两个写成一个SQL呀?
select * from a where (参数c is not null and b=参数c) or (参数c is null and b is not null)
select b
from a
where (v_c is not null and b = v_c)
or (v_c is null and b is not null)