Database SQL
-
Hello..i have a question about SQL Statements In my database, i have a data about datetime. The example as shown below: 2014-03-25 17:57:34.177 2014-03-25 18:01:25.280 2014-03-25 18:01:28.240 2014-03-25 18:01:33.207 This is just a few example but in my database the data is more than this.So how if i want to display the data from 30 minutes ago? what is the sql statement should I use?
-
Hello..i have a question about SQL Statements In my database, i have a data about datetime. The example as shown below: 2014-03-25 17:57:34.177 2014-03-25 18:01:25.280 2014-03-25 18:01:28.240 2014-03-25 18:01:33.207 This is just a few example but in my database the data is more than this.So how if i want to display the data from 30 minutes ago? what is the sql statement should I use?
SELECT * FROM tablename WHERE datefield > DateADD(mi, -30, Current_TimeStamp)
-
SELECT * FROM tablename WHERE datefield > DateADD(mi, -30, Current_TimeStamp)
tq :) and if i want to show from 1 hours is it like this SELECT * FROM tablename WHERE datefield > DateADD(mi, -60, Current_TimeStamp)?
-
tq :) and if i want to show from 1 hours is it like this SELECT * FROM tablename WHERE datefield > DateADD(mi, -60, Current_TimeStamp)?
Yes.
-
Yes.
tqvm for helping me :)
-
Yes.
Hye peter, this code seems did'nt work..when I execute this SQL to the database directly, it will show no result :(
-
Hye peter, this code seems did'nt work..when I execute this SQL to the database directly, it will show no result :(
Seeing is believing. try this: http://sqlfiddle.com/#!3/1fa93/13028