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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Age groupings 1

Status
Not open for further replies.

MasterAIK

Technical User
Mar 25, 2007
2
0
0
GB
I'm in a slight pickle and I thought you lovely people here could help me.

Basically I have a table and all is set up apart from the ages.

I have one field, 'Age' for the ages and I am wanting to create another called 'Age_groupings'.

I want the new field to essentially be able to categorize the ages into groupings and then present them. I am wanting to do this by a validation rule but it is proving rather tedious.

An example would be if the value under Age was 9 then the Age_grouping would recognise that and would display a value of 'Below 10'

Here are my age groupings:

Below 10
10-19
20-29
30-39
40-49
50-59
60-69
70+


I am not too good with databases so please excuse me if I don't understand your technical mumbo-jumbo.

Thanking you in advance,
AIK
 
You can group the ages in a query. There is no need for a field.
 
Thank you very much for the speedy reply =D
 
One suggestion appears to be missing from the above thread, and that is to use a separate range table with the range, the lower bound and the upper bound:

[tt]SELECT tblRanges.[Range], tblTable.Age
FROM tblTable, tblRanges
WHERE tblTable.Age Between tblRanges.upper And tblRanges.lower[/tt]
 
And what about something like this ?
SELECT Partition(Age,10,69,10) AS Range, Count(*) AS countOf
FROM yourTable
GROUP BY Partition(Age,10,69,10);


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top