SHARE
TWEET

Untitled

a guest Aug 13th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. orderId | creationDate
  2. 58111   | 2017-01-01 00:00:00
  3. 58111   | 2017-01-12 00:00:00
  4. 58232   | 2017-01-31 00:00:00
  5. 62882   | 2017-02-21 00:00:00
  6. 90299   | 2017-03-20 00:00:00
  7.    
  8. creationMonth | count_orderId
  9. January       | 2  
  10. February      | 1
  11. March         | 1
  12.    
  13. select count( distinct orderId ), year( creationDate ), month( creationDate )
  14. from my_table group by year( creationDate ), month( creationDate )
RAW Paste Data
Top