|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Last 10 minutesHow 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) Show quote "J1C" <just1co***@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... SELECT *
FROM your_table WHERE dt > DATEADD(MINUTE, -10, CURRENT_TIMESTAMP) ; -- Show quoteDavid Portas SQL Server MVP -- "J1C" <just1co***@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 ... > |
|||||||||||||||||||||||