Saturday, March 18, 2017

Stock balance


Stock balance 

select itemcode,itemname, sum(bal_qty) qty
from (
select itemcode,itemname, qty bal_qty  from br_receipt_detail
union all
select itemcode,itemname, -qty bal_qty  from br_issue_detail
)
group by itemcode,itemname


 Stock balance

select itemcode,itemname,sum(qty)
    from (
     select req_detail.itemcode,item.itemname,req_detail.qty from store.req_detail,store.item
    where item.itemcode=req_detail.itemcode
    and req_detail.reqno=500000137
    union all
    select itemcode,itemname,-qty from br_receipt_detail, br_receipt_master
    where br_receipt_master.recpt_no=br_receipt_detail.recpt_no
    and prs_no='500000137')
    group by itemcode,itemname

No comments:

Post a Comment

 https://www.linkedin.com/pulse/building-real-time-database-monitoring-dashboard-oracle-khaleeq-tpwxf/