Avatar of aneilg
aneilg
Flag 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)
SQL

Avatar of undefined
Last Comment
aneilg

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
TempDBA

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
aneilg

ASKER
perfect thanks.
Your help has saved me hundreds of hours of internet surfing.
fblack61