How could I return all records in the last that were entered in a
single table in the last 10 minutes? One of the columns is datetime ...SELECT <column_list>
FROM <tablename>
WHERE <datetime_column> >= DATEDIFF(MINUTE, -10, CURRENT_TIMESTAMP)
"J1C" <just1coder@.yahoo.ca> wrote in message
news:1129840012.172371.203250@.o13g2000cwo.googlegroups.com...
> How could I return all records in the last that were entered in a
> single table in the last 10 minutes? One of the columns is datetime ...
>|||SELECT *
FROM your_table
WHERE dt > DATEADD(MINUTE, -10, CURRENT_TIMESTAMP) ;
David Portas
SQL Server MVP
--
"J1C" <just1coder@.yahoo.ca> wrote in message
news:1129840012.172371.203250@.o13g2000cwo.googlegroups.com...
> How could I return all records in the last that were entered in a
> single table in the last 10 minutes? One of the columns is datetime ...
>|||Thanks ;) Right after I posted it I figured it out ..
select getdate() as 'now', dateadd(minute, -10, getdate()) as 'date
minus 10'|||> WHERE <datetime_column> >= DATEDIFF(MINUTE, -10, CURRENT_TIMESTAMP)
Whoops, don't know my dateadds from my datediffs today. That's the second
time I've transposed those in as many hours...|||No problem - I got it figured out. Thanks for the help!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment