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

Horizontal Scaling vs Vertical Scaling

 একটা application হঠাৎ করে অনেক বেশি user পেতে শুরু করল। আগে যেখানে ১,০০০ জন user ছিল, এখন সেখানে ১ লাখ user! তখন স্বাভাবিকভাবেই প্রশ্ন আসে—...