Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Need Help For the Scenario

Author  Topic 

dubaashu
Starting Member

10 Posts

Posted - 2013-12-17 : 18:44:58
Dear Experts,

I am having following Table

Table No1 RDR1 For Order Entry where We have Order No, Item code , Order Quantity
Table No2 OITW Where We have Present Stock

I want help as

OrderNo Itemcode OrderQty Instock Balance Qty
1 I0000252 10 100 90
20 I0000252 25 90 65
35 I0000252 50 65 15
40 I0000252 5 15 10

I want my balanceqty shows in reducing basis for particular item.

Thanks

Ashish

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-18 : 07:38:13
[code]
SELECT r.*,o.Instock ,o.Instock-r.OrderQty AS [Balance Qty]
FROM RDR1 r
INNER JOIN OITW o
ON o.Itemcode = r.Itemcode
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -