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
 finding oldest date

Author  Topic 

jlvollmer
Starting Member

2 Posts

Posted - 2009-10-07 : 21:42:01
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)

17689 Posts

Posted - 2009-10-07 : 22:02:02
"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
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

jlvollmer
Starting Member

2 Posts

Posted - 2009-10-08 : 09:56:23
Works great. Thanks a bunch.
Go to Top of Page
   

- Advertisement -