S
SANJAY SHAH \(MICROBRAIN Computers Pvt. Ltd.\)
Dear Sir,
In My Stock Master Table I am having following fields.
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 10 10 100
In Purchase Entry I had Purchase 5 quantity & Value is 60 and I have to
update as follows.
Purchase
---------
ItemCode Quantity Rate Value
-------------- -------- --------- --------
10001 5 12 60
StockMaster.Quantity=StockMaster.Quantity+Purchase.Quantity
StockMaster.Value=StockMaster.Value+Purchase.Value
StockMaster.Rate=StockMaster.Value/StockMaster.Quantity
So After Updating Result must be as follows
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 15 10.66 160
I had given query as follows
UPDATE Purchase, StockMaster SET
StockMaster.Quantity=StockMaster.Quantity+Purchase.Quantity
StockMaster.Value=StockMaster.Value+Purchase.Value
StockMaster.Rate=StockMaster.Value/StockMaster.Quantity
But It shows following result
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 15 10 160
While updating rate it is picking old value. How to do in one query. Please
reply me.
Sanjay Shah
In My Stock Master Table I am having following fields.
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 10 10 100
In Purchase Entry I had Purchase 5 quantity & Value is 60 and I have to
update as follows.
Purchase
---------
ItemCode Quantity Rate Value
-------------- -------- --------- --------
10001 5 12 60
StockMaster.Quantity=StockMaster.Quantity+Purchase.Quantity
StockMaster.Value=StockMaster.Value+Purchase.Value
StockMaster.Rate=StockMaster.Value/StockMaster.Quantity
So After Updating Result must be as follows
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 15 10.66 160
I had given query as follows
UPDATE Purchase, StockMaster SET
StockMaster.Quantity=StockMaster.Quantity+Purchase.Quantity
StockMaster.Value=StockMaster.Value+Purchase.Value
StockMaster.Rate=StockMaster.Value/StockMaster.Quantity
But It shows following result
StockMaster
-------------
ItemCode Quantity Rate Value
------------- ---------- -------- ---------
10001 15 10 160
While updating rate it is picking old value. How to do in one query. Please
reply me.
Sanjay Shah