|
Question : How do I take a totals query and update a column in another table?
|
|
I have the following query:
SELECT tblUpRooms.Room_Number, Count(PROJ_EQ.Equip) AS CountOfEquip FROM tblUpRooms INNER JOIN PROJ_EQ ON tblUpRooms.Room_Number = PROJ_EQ.Room_Number GROUP BY tblUpRooms.Room_Number;
It totals how many equip is in each room with each corresponding room number.
I want to take that data and update a specific column in my table: Â tblUpRooms with the field TotEquip. What kind of SQL statement would allow me to do that?
|
|
Answer : How do I take a totals query and update a column in another table?
|
|
I suspect that you're wanting to do something like
UPDATE tblUpRooms SET TotEquip = DCount("*", "PROJ_EQ", "Room_Number = " & [Room_Number]) FROM tblUpRooms
But that would be a violation of normalisation and a pain to maintain. (btw DCount is the doman aggregate in this example).
|
|
|