Click to See Complete Forum and Search --> : [Access] Join to IN RANGE ?


Clearcode
March 2nd, 2005, 04:56 PM
OK - I have a table wich includes a date of birth.
In a query I have a derived field Years Old : DateDiff("yyyy", [date of birth], Now)

How do I join this to a table [Age ranges] which has fields [low bound] and [high bound] ?

e.g.

[low bound] [high bound] [range name ]
0 5 Under 5 years
6 16 6 to 16 years
16 200 Over 16


Any ideas?

Krzemo
March 4th, 2005, 06:30 AM
SELECT *, Age FROM MyQuery as q INNER JOIN AgeRanges a ON (Age >=[low bound] and Age <[high bound]);

or

SELECT *, Age FROM MyQuery as q INNER JOIN AgeRanges a ON Age BETWEEN [low bound] AND [high bound];


Best regards,
Krzemo.