Hi,
I have created an unmatched query (with the help of this forum) but need to tweak it and can't figure out how.
I needed to create 2 queries, and then match the results.
The first query joins 3 tables, the 2nd query has one table.
Here's an explanation of what I am doing. I have a main table, called tblSpaceUse, which contains records for all rooms in a building. All Items that can be in the rooms are on tblItems. Rooms and Items are linked by tblRoomItems.
I wanted the unmatched query to look at all possible subcategories of items (tlkpSubcategory, the table in the 2nd query) and tell me what is missing from tblRoomItems for EACH ROOM. I've gotten this to work for one room. But, when I eliminate room number from the first query, it tells me what subcategories are missing from the COMPLETE table tblRoomItems. I need this information on a room-by-room basis, not overall table. How would I go about doing so? (I could either use tblSpaceUse or tblRoomItems as my room-by-room 'driver').
Here is my sql.
First query:
(I need tblSpaceUse in the query because I will need records by Room Type eventually).
Second query (this is the query I actually run):
Also, room number column is showing up blank in my current unmatched query.
Would appreciate any suggestions on how to get roomid to show up, and how to do this query on a room-by-room basis (possibly one solution for both questions).
Thanks in advance. I am completely new to this type of query.
Lori
I have created an unmatched query (with the help of this forum) but need to tweak it and can't figure out how.
I needed to create 2 queries, and then match the results.
The first query joins 3 tables, the 2nd query has one table.
Here's an explanation of what I am doing. I have a main table, called tblSpaceUse, which contains records for all rooms in a building. All Items that can be in the rooms are on tblItems. Rooms and Items are linked by tblRoomItems.
I wanted the unmatched query to look at all possible subcategories of items (tlkpSubcategory, the table in the 2nd query) and tell me what is missing from tblRoomItems for EACH ROOM. I've gotten this to work for one room. But, when I eliminate room number from the first query, it tells me what subcategories are missing from the COMPLETE table tblRoomItems. I need this information on a room-by-room basis, not overall table. How would I go about doing so? (I could either use tblSpaceUse or tblRoomItems as my room-by-room 'driver').
Here is my sql.
First query:
Code:
SELECT tblRoomItems.RoomID, tblSpaceUse.RoomTypeID, tblItems.ItemSubcategoryID
FROM tblSpaceUse INNER JOIN (tblRoomItems INNER JOIN tblItems ON tblRoomItems.ItemID = tblItems.ItemID) ON tblSpaceUse.RoomID = tblRoomItems.RoomID
WHERE (((tblRoomItems.RoomID)="286"));
Second query (this is the query I actually run):
Code:
SELECT tlkpItemSubcategory.ItemSubcatID, tlkpItemSubcategory.ItemSubcatDesc, tlkpItemSubcategory.ItemCategoryID, [#Unmatched1].RoomID
FROM tlkpItemSubcategory LEFT JOIN [#Unmatched1] ON tlkpItemSubcategory.ItemSubcatID = [#Unmatched1].ItemSubcategoryID
WHERE ((([#Unmatched1].ItemSubcategoryID) Is Null));
Would appreciate any suggestions on how to get roomid to show up, and how to do this query on a room-by-room basis (possibly one solution for both questions).
Thanks in advance. I am completely new to this type of query.
Lori