Let's say I have two tables:
Table A
employeeID (int)
employeeName (varchar)
employeeDOB (varchar)
Table B
employeeID (int)
holidaysUsed (int)
Table B is relational to Table A via employeeID. Table B can have zero or more rows linked to a single employeeID. I'd like to perform a SELECT on Table A but only retrieve rows in Table A when there are no corresponding records in table B.
I have a few ideas on this but I'd like to ensure I'm using the optimum query. Any help would be much appreciated.
Additional Information
Database platform: SQL Server 2008 R2
Typical returned dataset size 1000 records avg.
SELECT * FROM A WHERE employeeID NOT IN (SELECT employeeID FROM B);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With