Question

Locked

SQL in MS ACCESS : Date handling

By grinder182533 ·
My table (tblStaff) has a date of birth field (DOB) defined as a 'General Date'.
I need to write a Query that counts those rows where the staff are under 25 years old, at run time. I am new to SQL, so can anybody advise on the syntax please ?
Many Thanks

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

SQL in MS ACCESS : Date handling

by grinder182533 In reply to SQL in MS ACCESS : Date h ...

I have solved this by using this coding :
DateAdd("yyyy", 16, DOB) <= Date() &
DateAdd("yyyy", 16, DOB) > Date()

Collapse -

Try this

by Tony Hopkinson In reply to SQL in MS ACCESS : Date h ...

Select Count(*) From Staff Where DateAdd(year,25,DOB) < GetDate()

Few other variations

But DateAdd, DateSubtract ansd DatePart are along with GetDate()

are usually in there somewhere.

Collapse -

SQL in MS ACCESS : Date handling

by grinder182533 In reply to Try this

Thanks Tony
I have learned a lot more about dates these last few days !

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums