Avatar of hidrau
Flag for Brazil asked on

how can I make a query that can return only rows with 5 minutes behing?

Hello guys

I have a table where I have a field smalldatetime type.

This table is online feeds and I need to make a query that can return rows that was inserted into this table <= 5 minutes behind.

The field keeps with these information:

Date                                         Xml
2012-07-02 17:52:56.577      44357085000135
2012-07-02 17:53:26.600      44357085000135
2012-07-02 17:53:29.520      44357085000135
2012-07-02 17:53:32.310      44357085000135
2012-07-02 17:53:35.367      44357085000135
2012-07-02 17:54:06.080      44357085000135
2012-07-02 17:54:09.037      44357085000135
2012-07-02 17:54:39.207      44357085000135
2012-07-02 17:55:11.480      44357085000135

Microsoft SQL Server 2005

Avatar of undefined
Last Comment

8/22/2022 - Mon
Lara F

select * from myTable where datediff(mm, date, getdate()) >5
Lee Wadwell

<= 5 minutes behind
can you be more specific please? <= 5 minutes behind what in particular ... the current datetime, anothers rows datetime, something else?
Lara F

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck