Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. (select 'beginning'::varchar as t_date, sum(movementqty) as qty
  2. from m_transaction
  3. where m_product_id='0015779EEE8D4EA8A0E54228C4408B23'
  4. and movementdate<'2017-04-01')
  5.  
  6. union all
  7.  
  8. (select movementdate::date::varchar as t_date, sum(movementqty) as qty
  9. from m_transaction
  10. where m_product_id='0015779EEE8D4EA8A0E54228C4408B23'
  11. and movementdate>='2017-04-01'
  12. and movementdate<='2017-05-01'
  13. group by movementdate
  14. order by movementdate)
  15.  
  16. union all
  17.  
  18. (select 'saldo'::varchar as t_date, sum(movementqty) as qty
  19. from m_transaction
  20. where m_product_id='0015779EEE8D4EA8A0E54228C4408B23'
  21. and movementdate<='2017-05-01')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement