Home > Enterprise >  SQL select unique items from everyone's desk
SQL select unique items from everyone's desk

Time:05-26

I have a enter image description here

The answer should be

enter image description here

Ty kind stranger for helping me out.

CodePudding user response:

You can use this query for searching items that are on the desk and not on the other desk:

select *
from [Office] [outer]
where not exists( select 1 from [Office] 
                  where Item = [outer].Item
                  and WhoseDesk <> [outer].WhoseDesk )
  •  Tags:  
  • sql
  • Related