I am trying to update a table when there are matching items in another table
Table A - inventory
itemnum
balance
Table B - inventory_transactions
itemnum
qty
invoicenum
What I am trying to do, is to add the inventory qty back into the inventory table when an invoice gets cancelled or changed
Here is my SQL statement
UPDATE inventory SET
inventory.balance = inventory.balance + inventory_transactions.qty
INNER JOIN inventory_transactions
ON inventory.itemnum = inventory_transactions.itemnum
WHERE inventory.itemnum = inventory_transactions.itemnum
AND inventory_transactions.invoicenum = '1'
I am getting an error in the syntax near the INNER JOIN
Table A - inventory
itemnum
balance
Table B - inventory_transactions
itemnum
qty
invoicenum
What I am trying to do, is to add the inventory qty back into the inventory table when an invoice gets cancelled or changed
Here is my SQL statement
UPDATE inventory SET
inventory.balance = inventory.balance + inventory_transactions.qty
INNER JOIN inventory_transactions
ON inventory.itemnum = inventory_transactions.itemnum
WHERE inventory.itemnum = inventory_transactions.itemnum
AND inventory_transactions.invoicenum = '1'
I am getting an error in the syntax near the INNER JOIN