If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > age into age band

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-05, 01:20
edouardl edouardl is offline
Registered User
 
Join Date: Aug 2001
Posts: 6
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

Edward
Reply With Quote
  #2 (permalink)  
Old 11-02-05, 01:33
B Jarvis B Jarvis is offline
Registered User
 
Join Date: Sep 2005
Posts: 22
what i use is

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


Bill
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On