Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag 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

Thanks
Alex
Avatar of Lara F
Lara F
Flag of United States of America image

select * from myTable where datediff(mm, date, getdate()) >5
<= 5 minutes behind
can you be more specific please? <= 5 minutes behind what in particular ... the current datetime, anothers rows datetime, something else?
ASKER CERTIFIED SOLUTION
Avatar of Lara F
Lara F
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hidrau

ASKER

thanks