How to select last hour without timestamp in MySQL


Problem :

I would like to select all records from the last hour. Problem is, that I don't have an timestamp. I save the time in one row, and in another the date.

date        time
2015-11-27  10:55:04
2015-11-27  11:16:38
2015-11-27  11:57:29
2015-11-27  13:04:47
2015-11-27  14:29:00
2015-11-27  14:36:41
2015-11-27  14:52:46
2015-11-27  15:06:20
2015-11-27  15:30:24
2015-11-27  15:47:15

Is it possible to convert this to a timestamp in order to make the selection i wish according to this method: select rows from last 2 hours

thanks!



Solution :

I think I could solve the problem by myself. Thanks for your hints.

SELECT *
FROM recs
WHERE TIMESTAMP(`datefield`,`timefield`) BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) AND NOW();

Mysql Tutorials

Mysql Howto..

how to use replace function with in clause in mysql

MySQL: how to sort the words in a string using a stored function?

How can I order by date?

How to remove repetitive rows in MySQL when using JOIN

How to convert string value separated by comma into integer from mySQL

I'm using mybb, how can I find the top 5 threads that has the most readers currently?

PHP old data still showing after POST

MYSQL how to sort money values from cheaper to more expensive?

Don't know how to merge two MySQL tables

How to Fix This MySQL Query So It Works?

How to remove duplicate items in MySQL with a dataset of 20 million rows?

SQL count how many times a value appears in multiple columns?

How to check if a table already exists in the database by using MySQL?

How to log queries to stdout on MySQL?

How to store record changes in a mysql table

PHP - How to specify MySQL row name instead of number in mysql_result

How do I code this SQL query in Laravel? Correct way to code mySQL HAVING

How to close mysql connections explicitly in zend framework?

How to import my hosted mysql database to my local host database?

How to sort the result with multiple conditions in MySQL

How to force truncate all tables(which are all innodb) in a database in MySQL?

How to 'undo' this small function in PHP?

How to format the DateTimePicker into hh:mm:ss and What is the appropriate type to save time in mysql?

How to run php script on server through command line

how to use REGEXP with defined parameter in mysql?

How to Convert UTC Date To Local time Zone in MySql Select Query

How to partition Mysql across MULTIPLE SERVERS?

How to insert data as array values into MySQL?

If I specify any value for an auto-increment field, how can I get the next or previous value?

How can Write having count('*') in codeigniter