Exactly I need zplid and codetypeid that have feature value
on all rows .
if I have Null on zfeature key on one row then I don't Need it .
I need to get zplid that have features Not Null on all rows as zplid 9714
but 9823,5890 have Null so I don't Need it
this is my sample data
create table #gen
(
zplid int,
CodetypId int,
ZfeatureKey nvarchar(20)
)
insert into #gen(zplid,CodetypId,ZfeatureKey)
values
(9714,849774,1501290046),
(9714,849774,1501099991),
(9714,849774,1501555555),
(9823,9732410,1501290046),
(9823,9732410,1501099991),
(9823,9732410,NULL),
(5890,838651,1501290046),
(5890,838651,NULL),
(5890,838651,NULL)
expected result is
zplid CodetypId ZfeatureKey
9714 849774 1501290046
9714 849774 1501099991
9714 849774 1501555555
I tried to do as below :
select zplid,CodetypId,ZfeatureKey
from #gen
where ZfeatureKey is not null
but it give me zplid and codetypeid that have values ON Zfeature key on all rows of all zplid
and this I don't need