Friday, February 24, 2012

age into age band

Hi,

I have a table of members including date of birth value.

I am not finding any easy way to count the number of members per age band.
0-10, 10-20,20-30 etc.

It seems that the decode function works only for equality tests not for other complex conditions.

Until now, I am using as many count queries as age bands and look whether the date of birth of the member falls between two dates

Any thoughts?

Thanks

Edwardwhat i use is

select dob, floor(months_between(sysdate,dob)/120) ag from person;

Bill

No comments:

Post a Comment