Link to home
Start Free TrialLog in
Avatar of aneilg
aneilgFlag for United Kingdom of Great Britain and Northern Ireland

asked on

sql NOT IN

i have the following query.
my mappings table has 10 rows.
my execution log has 8 rows.

what i want to do is display users that are in the mappings but not in execution


SELECT DISTINCT


      b.Prac_Code,
      b.Windows_Login
      
FROM


      ReportServer.dbo.ExecutionLogStorage el with (nolock)
            left outer JOIN [Dashboards].UrgentCare.tbl_User_Mappings b  
                  ON el.UserName collate SQL_Latin1_General_CP1_CI_AS = b.Windows_Login

            and
            
            el.UserName NOT IN
            (SELECT el.UserName collate SQL_Latin1_General_CP1_CI_AS el
                  FROM [Dashboards].UrgentCare.tbl_User_Mappings b)
ASKER CERTIFIED SOLUTION
Avatar of TempDBA
TempDBA
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aneilg

ASKER

perfect thanks.