Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fralo
Posting Yak Master
161 Posts |
Posted - 2008-04-25 : 10:34:03
|
| I need to get a listing of all persons who are atleast 18 years of age. A date of birth field in the database is in this format:4/25/2008 12:00:00 AMMy solution would be where the difference between the current date and the dob is >= 18.I tried...select * from table where datediff(yy,dob,getdate)) >= 18.But this only seems to subtract the years and ignore the days/months, which I need. Could anyone provide the syntax I need?Help is appreciated. Thanks. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-25 : 10:48:16
|
http://www.sqlteam.com/article/datediff-function-demystified E 12°55'05.25"N 56°04'39.16" |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|