Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 tables like

Table 1 - Work Order
SI NO - Product -  Qty
  1     Monitor     10
  2     Mouse       20
  3     Keyboard    15
  4     Speaker     10


Table 2 - Bill
SI NO - Product - Product Id - Qty
  1     Monitor      1          5
  2     Mouse        2          8
  3     Speaker      4          7


When i click update button i want to show Table - work order like

SI NO - Product -  Qty
  1     Monitor     5
  2     Mouse       12
  3     Keyboard    15
  4     Speaker     3
Posted
Updated 7-Aug-14 0:22am
v2

1 solution

Hi,

Try this...


SQL
update work_order a
set
a.Qty=a.Qty - b.Qty
from
Bill b
where
a.SI_NO=b.Product_Id
--AND a.Product=b.Product


Hope this will help you.


Cheers
 
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