Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging fields

Status
Not open for further replies.

crysma

Programmer
Oct 17, 2002
21
CA
I've just been given a table containing customer information by region and age. Basically, each row contains the name of the region, and then the number of customers in that region aged 18 years, the number aged 19 years, and so on till 65. However, the client has decided that they don't need quite so much detail in their databases. Instead of recording the cusomer's actual ages, they've decided to go by age group, i.e. 18-24, 25-29, etc. Does anyone know how I can merge the information from the appropriate fields together to form the new fields? I'd really appreciate any help of pointers.

Thanks in advance,

Sheryll
 
Is the age a number or do you need to calculate the age from a date field?
 
If the age is already calculated, then here is a simple example of the partition function. This groups in 5 year intervals starting at the lowest age and continuing until 65.

SELECT DISTINCTROW Partition([age],0,65,5) AS Range, Count([age]) AS [Count]
FROM Categorys
GROUP BY Partition([age],0,65,5);
 
the age is already calculated. Thanks for your help, i will try that out :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top