dates diff in mysql query
Posted: Mon Mar 01, 2004 11:30 am
Hello all,
I have a table which one of it's fields is a timestamp.
I want to select from this table only the records from the last 15 minutes.
I.E. get the system time and compare it to the time stamp in the specific field. if the differnce is less than 15 mins (or any other anount of minutes that i will set up) select the row.
I'm sure it's possible to do in a query and I don't have to get all rows and check in a php script, but I don't now quite how to achive that.
Any ideas?
I have a table which one of it's fields is a timestamp.
I want to select from this table only the records from the last 15 minutes.
I.E. get the system time and compare it to the time stamp in the specific field. if the differnce is less than 15 mins (or any other anount of minutes that i will set up) select the row.
I'm sure it's possible to do in a query and I don't have to get all rows and check in a php script, but I don't now quite how to achive that.
Any ideas?