Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- o_id o_c_id o_type o_date
- 1345 2145 TA 2015-01-01
- 7499 2145 TA 2015-01-16
- 7521 2146 GA 2015-01-08
- 7566 2146 TA 2016-01-24
- 7654 2147 FB 2016-01-28
- c_id c_name c_email
- 13 Anderson example@gmail.com
- 14 Pegasus example@gmail.com
- 15 Miguel example@gmail.com
- 16 Megan example@gmail.com
- select c.id, c.name, count(*) as counts, year(o.date)
- from orders o
- join customer c on o.c_id=c.id
- where year(o.date) > 2009
- group oy c.id
- having count(*) > 7
Add Comment
Please, Sign In to add comment