Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select d.id,
- coalesce(t1.txtname, t2.txtitem) txtitem,
- t1.purch_price,
- t1.sale_price,
- t1.limit,
- t1.firstbalance,
- sum(t2.qty) as 'purchaseqty'
- from
- (
- select id from item
- union
- select iditem from inv_sub,inv WHERE inv.id = inv_sub.no and inv.type = 'شراء'
- ) d
- left join item t1
- on d.id = t1.id
- left join inv_sub t2
- on d.id = t2.iditem
- GROUP BY d.id,t2.iditem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement