java - Updating two tables sql -
i have table tblpurchase , tblsale want update quantities of both tables salesperson purchases thing seller
create table tblpurchase( id int primary key, p_name varchar(50) , p_qty int, date varchar(50), cust_name varchar(50) )
the second table
create table tblsale ( id int primary key, p_name varchar(50), p_qty varchar(50), )
now how can update tblpurchase on sale in tblsale? here stored procedure tried use want implement in java how it?
create proc deduce @p_id int @p_quantity varchar(50) update tblpurchase set p_qty = p_qty - @p_quantity update tblsale set s_qty = s_qty + @p_quantity @p_id = @p_id
i not going answer entirely, can give hint. create triggers gets triggered when there sale in tblsale table. problem see in tblsale, why p_qty varchar? should int.
Comments
Post a Comment