Guest User

Untitled

a guest
Nov 22nd, 2017
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. o_id o_c_id o_type o_date
  2. 1345 2145 TA 2015-01-01
  3. 7499 2145 TA 2015-01-16
  4. 7521 2146 GA 2015-01-08
  5. 7566 2146 TA 2016-01-24
  6. 7654 2147 FB 2016-01-28
  7.  
  8. c_id c_name c_email
  9. 13 Anderson example@gmail.com
  10. 14 Pegasus example@gmail.com
  11. 15 Miguel example@gmail.com
  12. 16 Megan example@gmail.com
  13.  
  14. select c.id, c.name, count(*) as counts, year(o.date)
  15. from orders o
  16. join customer c on o.c_id=c.id
  17. where year(o.date) > 2009
  18. group oy c.id
  19. having count(*) > 7
Add Comment
Please, Sign In to add comment