Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL get last 5 minutes data

-- for last 5 mins 
SELECT * 
FROM table_name
WHERE  (SELECT  CONVERT(char(5),SYSDATETIMEOFFSET() AT TIME ZONE 'Central Standard Time', 108))                        
  BETWEEN   CONVERT(VARCHAR(5),CreationDate,108) AND CONVERT(VARCHAR(5), DATEADD(mi, 5,CreationDate),108)                          

-- for last 15 mins 
SELECT * 
FROM table_name
WHERE  (SELECT  CONVERT(char(5),SYSDATETIMEOFFSET() AT TIME ZONE 'Central Standard Time', 108))                        
  BETWEEN   CONVERT(VARCHAR(5),CreationDate,108) AND CONVERT(VARCHAR(5), DATEADD(mi, 15,CreationDate),108)                          
Comment

PREVIOUS NEXT
Code Example
Sql :: Select with remove white spaces in sql 
Sql :: sql output select 
Sql :: import csv to postgresql 
Sql :: psql check if value in array 
Sql :: oracle sql unique 
Sql :: mysql into outfile with headers 
Sql :: change column name sql 
Sql :: datagrip execute procedure 
Sql :: copy a table mysql 
Sql :: mysql select case insensitive 
Sql :: oracle get foreign keys on table 
Sql :: local database sql 
Sql :: make parameters nullable in sql server 
Sql :: how to get column name in db from an sqlalchemy attribute model 
Sql :: date in mysql 
Sql :: mysql delete older duplicates 
Sql :: dump multiple tables mysql 
Sql :: mysql update 
Sql :: SQL FETCH FIRST Clause 
Sql :: sql server delete records with specific date 
Sql :: mysql query where in select 
Sql :: find the all the constraints in a specific table 
Sql :: how to add more columns to a table in mysql 
Sql :: how to check common records in 2 table 
Sql :: mysqli_free_result 
Sql :: postgres drop all tables 
Sql :: bigquery information_schema schema all columns 
Sql :: sql insert into select statement 
Sql :: sql select where id not exists in another table 
Sql :: how to declare variable date in mysql 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =