Click here to Skip to main content
16,021,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 2 differen tables

Article

- articlenumber
- stock

Order

- ordernumber
- articlenumber
- received goods

I want to increment my stock in table Article with the received goods from table order, how can I manage this?

I am using apex/oracle
Posted

SQL
UPDATE A SET A.stock=B.receivedgoods FROM Article A
INNER JOIN Order B
ON A.articlenumber=B.articlenumber
 
Share this answer
 
If i'm not wrong, below query should do the job:
SQL
UPDATE Article t1 SET stock = (SELECT [received goods] AS stock FROM [Order] t2 WHERE t2.articlenumber = t1.articlenumber)


It's strongly recommended to change the name of Order table, because it is one of reserved words of Oracle database[^]! You can use Orders instead.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900