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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date under 21

Author  Topic 

PhiL56
Starting Member

2 Posts

Posted - 2009-12-14 : 11:04:25
I have a date in a table which is a users date of birth.

Basically I want to check if they are under 21 according to todays date.

Thank you for any help.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-12-14 : 11:20:04
where yourdate < dateadd(yy,-21,getdate())
Go to Top of Page

PhiL56
Starting Member

2 Posts

Posted - 2009-12-14 : 11:29:05
Works Great thank you very much!!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-14 : 13:33:48
Don't you need to add > 17????

You could get in trouble you know



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-14 : 13:34:26
That was too easy

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-12-15 : 04:55:38
Are you suggesting < 21's are easy?
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-12-15 : 07:25:42
/moves Brett up the hate list another notch.



http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -