Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 finding oldest date
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jlvollmer
Starting Member

2 Posts

Posted - 10/07/2009 :  21:42:01  Show Profile  Reply with Quote
I have searched all over and cannot find much information about the use of MAX in a query.

I am wanting to select all records from users table where deceased=FALSE AND select the MAX(birthday) of that group. So basically find the oldest person in the users table who is not deceased.

Please help!

khtan
In (Som, Ni, Yak)

Singapore
17689 Posts

Posted - 10/07/2009 :  22:02:02  Show Profile  Reply with Quote
"find the oldest person in the users table who is not deceased."
should be a MIN(birthday) right ? unless birthday is not the date of birth but the age of a person


select *
from   users u
where  u.deceased = 'FALSE'
and    u.birthday = (select MIN(birthday) from users x where x.deceased = 'FALSE')



KH
Time is always against us


Edited by - khtan on 10/07/2009 22:02:37
Go to Top of Page

jlvollmer
Starting Member

2 Posts

Posted - 10/08/2009 :  09:56:23  Show Profile  Reply with Quote
Works great. Thanks a bunch.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000