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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mulitple Line Update Query

Status
Not open for further replies.

andyb2005

IS-IT--Management
Feb 9, 2005
58
0
0
GB
I have two tables.
[Stock] has a list of part numbers and quantities.
[Order] has a list of part numbers and their order number.

So [Order] table could have the following data:

Index, Order No, Qty, Part No,
101 9702 1 121-454
102 9702 2 121-403
103 9702 1 120-500
104 9703 3 121-454

[Stock] table looks like this:
Part No, Qty
120-500 50
121-454 10
121-455 20


I want to be able to update the [Stock] table quantities from the [Order] table.

How would I do this in an access query to update multiple order rows.
 
here is one option

Code:
UPDATE stock INNER JOIN orders ON stock.[part no]= order.[part no] SET stock.qty = [stock].[qty]-[order].[qty]
where index > 101

next time you run query index would be 104 so you dont do it more then one time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top