Change INSERT to UPDATE

Stormrider83

Computer Science Student
Local time
Today, 21:35
Joined
Jul 16, 2008
Messages
26
Hi,

I have code which sucessfully copies rows from a query to a table.

What I want to do is update records in a table based on a query in another table. Can anyone convert the following SQL to do this:

Code:
INSERT INTO Tbl_Paint_Order_Parts ( Paint_Order_ID, Part, Qty )
SELECT Qry_Paint_Order_Parts.Paint_Order_ID, Qry_Paint_Order_Parts.Part_No, Sum(Qry_Paint_Order_Parts.Qty) AS SumOfQty
FROM Qry_Paint_Order_Parts
GROUP BY Qry_Paint_Order_Parts.Paint_Order_ID, Qry_Paint_Order_Parts.Part_No
ORDER BY Qry_Paint_Order_Parts.Part_No;

I want to loop through EVERY record in the query Qry_Paint _Order_Parts and copy the Qty field into the table Paint_Order_Parts.Qty field.

The Query is NOT updatable as it contains many tables with a many-to-one-to-many relationship BUT the INSERT CODE works!

I cannot however get the update code to work...

Any help would be much appreciated!
 
You may have to create a temp table to do this.
 
Oh good lateral thinking there!
 
Let's us know if / how you get it to work - :p
 

Users who are viewing this thread

Back
Top Bottom