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
 max function

Author  Topic 

sw9mba
Starting Member

2 Posts

Posted - 2009-10-09 : 12:08:03
i have a tabla called mt_read which has three fields : mt_name,mt_value,mt_time.
i want to select for a specific date-time from the mt_time field the exact closer to the specific date-time last value of mt_value field.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-09 : 12:25:06
You can make it more clear by giving tablestructure, sample data and wanted output.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-09 : 12:44:48
may be this

SELECT TOP 1 mt_name,mt_value,mt_time
FROM yourtable
WHERE mt_time<=@dateval
ORDER BY mt_time DESC
Go to Top of Page
   

- Advertisement -