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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Select help

Author  Topic 

maddyslayer
Yak Posting Veteran

57 Posts

Posted - 2013-06-14 : 10:28:00
There is a table called "customer" where one of the columns is "date".
How do i get the latest modified records from that table and the time difference between those modified records is less than or equal to 10 sec?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-14 : 10:38:12
Do you mean this?

SELECT *
FROM
(
SELECT *,MAX(date) OVER () AS MaxDate
FROM customer
)t
WHERE ABS(DATEDIFF(ss,date,MaxDate)) <=10



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -