Question : SQL - Find records in one table not in another

I wrote a few loops in C# and it works quite fast, but ideally I'd like to keep the datatable bound to the database so that updates to the table can be saved back to the DB.  So, I wrote this simple SQL query that extracts all records in one table that do not exist in the other table, between user selected dates.  This query takes 7-10 seconds.  Can this be improved?
Code Snippet:
1:
SELECT * FROM RawData AS a WHERE (DataOrigin = '" + OrgSelection + "') AND (DateTime >= '" + UBDate + "') AND (DateTime <= '" + UEDate + "' AND NOT EXISTS (SELECT * FROM PrintData AS b WHERE b.[ID] = a.[ID]))

Answer : SQL - Find records in one table not in another

Closing bracket missing:


"SELECT a.* FROM RawData AS a
LEFT JOIN PrintData AS b
ON b.[ID] = a.[ID]
WHERE (a.DataOrigin = '" + OrgSelection + "') AND (a.DateTime >= '" + UBDate + "') AND (a.DateTime <= '" + UEDate + "')
AND b.[ID] IS NULL  "

Random Solutions  
 
programming4us programming4us