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 |
beamer7296
Starting Member
2 Posts |
Posted - 2007-11-09 : 11:11:43
|
I am using PeopleSoft's query manager.Basically, I have 2 fields, A.BIRTHDATE and F.START_DT.I want to add an expression that will allow me to only list "students" who will be 21 when the class begins (start date).I have an extensive programming background, but I've never written any SQL. I would really appreciate any help that you can offer! |
|
beamer7296
Starting Member
2 Posts |
Posted - 2007-11-09 : 11:14:52
|
The birthdate and stardate fields are currently in the following format: MM/DD/YYYY |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-09 : 11:41:53
|
Well, it depends on the accuracy required. 1 will still be less than 21 and the where condition will be false anyway  KH[spoiler]Time is always against us[/spoiler] |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-11-09 : 11:48:48
|
This should work, provided that the column datatypes are datetime:where F.START_DT >= -- 21st Birthday dateadd(year,21,A.BIRTHDATE) CODO ERGO SUM |
 |
|
|
|
|
|
|