cheekybuddha
AWF VIP
- Local time
- Today, 17:36
- Joined
- Jul 21, 2014
- Messages
- 2,678
Wow! I really must need some more coffee today!
I missed out a comma after the 't.*'
See if this works:
I missed out a comma after the 't.*'
See if this works:
Code:
SELECT
t.*,
Switch(
t.Age < 4, '0 - 3',
t.Age < 12, '4 - 12',
t.Age < 13, '12 - 13',
t.Age < 17, '13 - 17',
t.Age < 30, '18 - 30',
t.Age >= 30, '30 plus'
) AS [Range]
FROM (
SELECT
ID,
[Name],
DoB,
IIf(
IsDate([DoB]),
Year(Date()) - Year([DoB]) + (Date() < DateSerial(Year(Date()), Month([DoB]), Day([DoB]))),
Null
) AS Age
FROM tblReg
) t;