D
Dave Cullen
I need a query that will give me the rows in one table that are NOT in
another table or query.
Example: Hospital admissions application. There's a Rooms table listing
all rooms in the hospital. ROOM_NO is the primary key. Another table,
HospitalVisits, lists all patient visits past and present. ROOM_NO is
one of the columns, along with RELEASE_DATE. A query of CurrentVisits
selects all HospitalVisits records where the release date is null.
I need to make a query to select a room that is NOT currently in use.
When I join Rooms and CurrentVisits, there's no selection criteria for
EXCLUSIVE values. I can only get a list of rooms currently in use, not
the others.
The SQL looks like this:
SELECT Rooms.ROOM_NO
FROM Rooms INNER JOIN [CurrentVisits]
ON Rooms.ROOM_NO=[CurrentVisits].ROOM_NO;
How do I stipulate "not contained in" instead of = ?
Thanks
another table or query.
Example: Hospital admissions application. There's a Rooms table listing
all rooms in the hospital. ROOM_NO is the primary key. Another table,
HospitalVisits, lists all patient visits past and present. ROOM_NO is
one of the columns, along with RELEASE_DATE. A query of CurrentVisits
selects all HospitalVisits records where the release date is null.
I need to make a query to select a room that is NOT currently in use.
When I join Rooms and CurrentVisits, there's no selection criteria for
EXCLUSIVE values. I can only get a list of rooms currently in use, not
the others.
The SQL looks like this:
SELECT Rooms.ROOM_NO
FROM Rooms INNER JOIN [CurrentVisits]
ON Rooms.ROOM_NO=[CurrentVisits].ROOM_NO;
How do I stipulate "not contained in" instead of = ?
Thanks