Wednesday, 14 August 2013

How to INSERT in one table and UPDATE in another in single QUERY?

How to INSERT in one table and UPDATE in another in single QUERY?

Good Day,
I'm currently creating some sort of inventory system. i have master_tbl
where in I save the items. in master_tbl, i have column 'qty_left' or the
available stock left.
also I have issuance_tbl where in I save all the transaction in issuing
items. in this table there is 'issued_qty'.
my problem is how can I be able to INSERT record in issuance_tbl at the
same time UPDATE the master_tbl.qty_left. (master_tbl.qty_left -
issuance_tbl.issued_qty).
is it possible??
thanks for your reply.
-martin

No comments:

Post a Comment