在qyjl字段中有几行是NULL,还有一部分有数据(如名字之类的),在查询时怎么让NULL的也显示出来,求教求教
declare @qyjl as varchar(10)
set @qyjl = ''select a.dwmch, c,qyjl from a, b, c
where a.dwbh=b.dwbh
and a.djbh = c.djbh
and (c.qyjl = isnull(@qyjl, c.qyjl) or c.qyjl = (case when @qyjl = '' then c.qyjl else @qyjl end))
怎么能让它这样显示:
qyjl
null --上面写出来的这个NULL都显示不了
null
null
张三
李四
王五
declare @qyjl as varchar(10)
set @qyjl = ''select a.dwmch, c,qyjl from a, b, c
where a.dwbh=b.dwbh
and a.djbh = c.djbh
and (c.qyjl = isnull(@qyjl, c.qyjl) or c.qyjl = (case when @qyjl = '' then c.qyjl else @qyjl end))
怎么能让它这样显示:
qyjl
null --上面写出来的这个NULL都显示不了
null
null
张三
李四
王五
where a.dwbh=b.dwbh
and a.djbh = c.djbh
and (c.qyjl = isnull(@qyjl, c.qyjl) or c.qyjl = (case when @qyjl = '' then c.qyjl else @qyjl end)) or qyjl is null
a.dwmch, c,qyjl
from
a, b, c
where
a.dwbh=b.dwbh
and
a.djbh = c.djbh
and
(c.qyjl = isnull(@qyjl, c.qyjl) or c.qyjl = (case when @qyjl = '' then c.qyjl else @qyjl end))
or
(qyjl is null)