How to get last 5 mins record from SQL database table?

dhamo

How to get last 5 mins records from SQL table.

E.g: I have one table name called Student.

ID Name        StartTime
-- ----------  ----------------------
1  abc         2016-05-18 08:00:29.587 
2  xxx         2016-05-18 08:05:30.287
3  xyz         2016-05-18 08:10:30.287

Consider now the Time is 8:15am. I would like to get last 5mins record from "Student" table.

E.g: I need "xyz" user information.

I tried below queries not working.

select * from Student where startTime is not null and startTime <  GetDate() and startTime > dateadd(minute, -5, GetDate())

But i am getting null values from student table.

How to do it. please help me to solve.

Chetan Sanghani
select * from Student where startTime is not null and startTime > DATEADD(minute, -5,  GETUTCDATE())

try this code

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get last 5 mins record from SQL database table?

From Dev

How to get last inserted record from core database?

From Dev

How to get the last record from Ms Access table

From Dev

How to get the last record from Ms Access table

From Dev

How to get Last and Secondlast Record from mysql table

From Dev

Efficient way to get last record from the database

From Dev

How do I get the last record from sql server?

From Dev

how to get second last record from driverid Sql server

From Dev

Spring Data - get last record from the table

From Dev

Get Last Five Record From Table

From Dev

How to return last record from database in codeigniter?

From Dev

How to get the last 5-10 message from a database?

From Dev

how to get last inserted record in a table?

From Dev

How to get data of last 3 months from sql table

From Dev

How to get the table names from "SQL script" in SQL Server database

From Dev

How to get last 10 mins records using linq?

From Dev

How to get last 7 days record from table as per date using PHP and MySQL

From Dev

How to get last record from column if there is no any unique ID for this record?

From Dev

Get last record in mysql table

From Dev

SQL query to retrieve last record from a linked table

From Dev

Only the last record in sql table is being updated from a form

From Dev

Get the last entered id from a table in sql

From Dev

SQL2008 select row if last date hasnt updated in last 5 mins per unique ID

From Dev

How to get values from database from current date to last 5 days

From Dev

How do I get the second last record of a table in laravel

From Dev

Get all record from one table plus the relative last record of a second table

From Dev

How to get the last value from the database

From Dev

How to get the last value from the database

From Dev

SQL: efficiently get the last record

Related Related

  1. 1

    How to get last 5 mins record from SQL database table?

  2. 2

    How to get last inserted record from core database?

  3. 3

    How to get the last record from Ms Access table

  4. 4

    How to get the last record from Ms Access table

  5. 5

    How to get Last and Secondlast Record from mysql table

  6. 6

    Efficient way to get last record from the database

  7. 7

    How do I get the last record from sql server?

  8. 8

    how to get second last record from driverid Sql server

  9. 9

    Spring Data - get last record from the table

  10. 10

    Get Last Five Record From Table

  11. 11

    How to return last record from database in codeigniter?

  12. 12

    How to get the last 5-10 message from a database?

  13. 13

    how to get last inserted record in a table?

  14. 14

    How to get data of last 3 months from sql table

  15. 15

    How to get the table names from "SQL script" in SQL Server database

  16. 16

    How to get last 10 mins records using linq?

  17. 17

    How to get last 7 days record from table as per date using PHP and MySQL

  18. 18

    How to get last record from column if there is no any unique ID for this record?

  19. 19

    Get last record in mysql table

  20. 20

    SQL query to retrieve last record from a linked table

  21. 21

    Only the last record in sql table is being updated from a form

  22. 22

    Get the last entered id from a table in sql

  23. 23

    SQL2008 select row if last date hasnt updated in last 5 mins per unique ID

  24. 24

    How to get values from database from current date to last 5 days

  25. 25

    How do I get the second last record of a table in laravel

  26. 26

    Get all record from one table plus the relative last record of a second table

  27. 27

    How to get the last value from the database

  28. 28

    How to get the last value from the database

  29. 29

    SQL: efficiently get the last record

HotTag

Archive