TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
275.3k
How to get zplid that have two code type one code type have Null on zf
Dec 13 2020 9:52 AM
How to get zplid that have two code type one code type have Null on zfeature key and another have value only without null ?
I work on sql server 2012 . I face issue I can't get zplid from table #gen that have Null only zfeature key on code type and another have value only
on zfeaturekey based on zplid and codetypeid .
meaning I need to get rows that have NULL ON zfeaturekey and Values on Zfeaturekey but must be different code type but same zplid
create table #gen
(
CodeTypeId int,
Zplid int,
Zfeaturekey nvarchar(50)
)
insert into #gen values
(854838,25820,NULL),
(849774,25820,1502260001),
(849774,25820,1502260016),
(854890,28700,NULL),
(849780,28700,1502260013),
(849780,28700,1502260030),
(987431,26777,1502270003),
(987431,26777,1502280005),
(987431,26777,1502290001),
(987471,26720,NULL),
(987490,26720,1502280005),
(987490,26720,NULL)
xpcted Result :
CodeTypeId Zplid Zfeaturekey
854838 25820 NULL
849774 25820 1502260001
849774 25820 1502260016
854890 28700 NULL
849780 28700 1502260013
849780 28700 1502260030
result will be zplid 25820 and 28700 because it have more than on code type code type 854890 and have null on zfeature key
and code type 849774 and not have null only value
i will not get zplid 26777 because it Not have NULL ON zfeaturekey
i will not get zplid 26720 because it have NULL ON BOTH Code Type ON zfeaturekey
Reply
Answers (
1
)
Create Table based on Below Data
How to pivot Feature values On Features based on parts Exist on table