Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update query 1

Status
Not open for further replies.

canett

Technical User
Jan 22, 2006
18
BG
Can you help me with an update query? I want to update
the query sql in such a way, that the cartons should be
the same as branch0 and quantity as items0 in the folloiwng sql:

Dim sqlOnStock As String
SQLOnStock = " SELECT Products.Productid, roducts.branch0, Products.items0 FROM Products"

Dim sql1 as string
sql1 = "SELECT DISTINCTROW [Order Details].OrderID,
[Order Details].ProductID, [Order Details].Quantity,
[Order Details].cartons FROM Products INNER JOIN [Order Details] ON Products.Productid = [Order Details].ProductID
ORDER BY [Order Details].OrderID"





 
Like this ?
UPDATE [Order Details] AS D INNER JOIN Products AS P ON D.ProductID = P.Productid
SET D.cartons = P.branch0, D.Quantity = P.items0

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top