SQl to list rows if not in another table
        Posted  
        
            by SmartestVEGA
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by SmartestVEGA
        
        
        
        Published on 2010-03-22T14:08:50Z
        Indexed on 
            2010/05/17
            3:10 UTC
        
        
        Read the original article
        Hit count: 386
        
I have the following query which have 1000 rows
select 
staffdiscountstartdate,datediff(day,groupstartdate,staffdiscountstartdate),
EmployeeID 
from tblEmployees 
where GroupStartDate < '20100301' and StaffDiscountStartDate > '20100301' 
and datediff(day,groupstartdate,staffdiscountstartdate)>1 
order by staffdiscountstartdate desc
i have the following query which have 400 rows: ie the employees in tblemployees and in tblcards
select a.employeeid,b.employeeid 
from tblEmployees a,tblCards b 
where GroupStartDate < '20100301' 
and StaffDiscountStartDate > '20100301' 
and datediff(day,groupstartdate,staffdiscountstartdate)>1 
and a.employeeid=b.employeeid 
How to list the employees which is there in tblemployees and not in tblcards?
ie is 1000-400 = 600 rows ???
© Stack Overflow or respective owner