MySQL Forums
Forum List  »  Newbie

Re: Return 0 for data with no matching values
Posted by: Peter Brawley
Date: March 21, 2015 02:21PM

For aggregation on year you'll need something like ...

select c.yr, count(d.dates)
from (select distinct year(date) yr from calendar) c
left join birthdates d on c.yr=year(d.dates)
group by c.yr;

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.