Negative Record Selection

CarlRostron

Registered User.
Local time
Today, 16:33
Joined
Nov 14, 2011
Messages
88
I have three tables, Invoice, Timesheet and Linker.

Invoice can contain several Timesheets and any client can have a number of Invoices.

The Linker table stores the InvoiceID and the TimsheetID so I can keep track on which Timesheet Records are attached to any individual invoice record.

Here is my dilemma.

Any individual Timsheet record can be attached to one and only one Invoice. I am trying to generate a query which finds out which Timesheets are NOT on any invoice.

Please help.
 
Try this, adjust your table and field names as needed.

SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
and table_name2.column_name is NULL;
 
Great stuff. Thanks :-)
 

Users who are viewing this thread

Back
Top Bottom