Skip to content

Instantly share code, notes, and snippets.

@ManiruzzamanAkash
Created November 11, 2019 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManiruzzamanAkash/6a007bc1fb0c577a741ecab206d90fb4 to your computer and use it in GitHub Desktop.
Save ManiruzzamanAkash/6a007bc1fb0c577a741ecab206d90fb4 to your computer and use it in GitHub Desktop.
Get Date wise product sale quantity summation
SELECT pro.id, pro.name,pro.sku, sum(tsl.quantity) as totalSoldQty, LEFT(tsl.created_at, 10) as date
FROM products as pro
LEFT JOIN transaction_sell_lines tsl on tsl.product_id=pro.id
where sku=26017 and tsl.created_at between '2019-07-01' and '2019-08-30'
and pro.business_id=7
GROUP BY LEFT(tsl.created_at, 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment