View Single Post
Old August 5th, 2004, 08:49 AM
happygv happygv is offline
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post


It would always be tedious for you to produce that exact result you are looking for with this kind of setup. As SQL itself has a DATETIME datatype, from which you can produce this exact result with less effort. I feel you have complicated things by having the Year/Month/Day as different columns. Merge them together, you can easily achieve that.
Select * from TableName where datediff(yy,AgeColumnName, getdate()) BETWEEN 18 and 25
Is that NOT so easy?

Else you will have to do all that calculations yourself from each year and then month and then day from your table... that is something really I can't think about.

Hope this helps.

- Vijay G
Strive for Perfection