I want to retrieve records for last 30 minutes in a table. How to do that? Below is my query..
select * from [Janus999DB].[dbo].[tblCustomerPlay] where DatePlayed < CURRENT_TIMESTAMP and DatePlayed > (CURRENT_TIMESTAMP-30)
Advertisement
Answer
Change this (CURRENT_TIMESTAMP-30)
To This: DateADD(mi, -30, Current_TimeStamp)
To get the current date use GetDate().
MSDN Link to DateAdd Function
MSDN Link to Get Date Function