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 |
rajukotla
Starting Member
9 Posts |
Posted - 2008-05-16 : 00:32:30
|
HOW TO GET THE LAST LATEST DATE..FOR EG.,I HAVE DATES LIKE THIS..3/5/20081/5/20084/5/20088/5/20086/5/2008I NEED TO GET THE RESULT 8/5/2008 AS TODAY IS 16/5/2008 |
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-05-16 : 04:58:14
|
hi try thisdeclare @t table (date datetime) insert @t select convert(datetime, '3/5/2008',103) union allselect convert(datetime, '1/5/2008',103) union allselect convert(datetime, '8/5/2008',103) union allselect convert(datetime, '6/5/2008',103)union allselect convert(datetime, '1/6/2008',103) union allselect convert(datetime, '23/4/2008',103)select top 1* from @t order by date descok tanx...... |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-05-16 : 13:01:54
|
Maybe:SELECT MAX(Date) FROM MyTable |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-16 : 14:02:40
|
SELECT MAX(Date) FROM MyTable WHERE Date < GETDATE() |
 |
|
|
|
|