Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. select d.id,
  2. coalesce(t1.txtname, t2.txtitem) txtitem,
  3.  
  4. t1.purch_price,
  5. t1.sale_price,
  6. t1.limit,
  7. t1.firstbalance,
  8. sum(t2.qty) as 'purchaseqty'
  9.  
  10. from
  11. (
  12. select id from item
  13. union
  14. select iditem from inv_sub,inv WHERE inv.id = inv_sub.no and inv.type = 'شراء'
  15.  
  16. ) d
  17. left join item t1
  18. on d.id = t1.id
  19. left join inv_sub t2
  20. on d.id = t2.iditem
  21. GROUP BY d.id,t2.iditem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement