sql - TSQL find missing Values for repeating records -


sample data:

pageid  attribute 2860    category 2860    sub-category 2861    tag 2861    tag 2862    tag 2862    category 2863    sub-category 2883    category 2883    sub-category 

problem # 1: need find page ids attribute sub-category not exists result should :

2861 2862 

problem # 2: need find page ids attribute sub-category , attribute category both not exists result should :

2861 

1)

select pageid  thetable  pageid not in (select pageid thetable attribute = 'sub-category') 

2)

select pageid  thetable  pageid not in (select pageid thetable attribute = 'sub-category') , pageid not in (select pageid thetable attribute = 'category') 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -