Re: Return 0 for data with no matching values
I had to change the query a little bit to get it to work (birthday to birthdates), but it did work:
select c.yr, count(d.birthday)
from (select distinct year(dates) yr from calendar) c
left join birthdates d on c.yr=year(d.birthday)
group by c.yr;
I also found that if you don’t alias birthdates to ‘d’, it still works, but you have to be more verbose in other places:
select c.yr, count(birthdates.dates)
from (select distinct year(dates) yr from calendar) c
left join birthdates on c.yr=year(birthdates.dates)
group by c.yr;
Thank you. After several days of trying you have really helped me out.
Subject
Written By
Posted
Re: Return 0 for data with no matching values
March 24, 2015 07:09PM
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.