Hi,
I have to build a mysql statement which has to select all records for a
specific date. The date is stored in a timestamp column.
I don't know how to compare a date (i.e. 2000-05-08) with a datetime
(i.e. 2000-05-08 10:30:50) in a select statemen|||You could convert them both to a string:
DATE_FORMAT(date_field1, '%d-%m-%Y') = DATE_FORMAT(date_field2, '%d-%m-%Y')
Or you can cast the datetime to a date field using
CAST(date_field1 as Date)|||You just redefine the datetime as you select it|||well they are two separate data type of my sql as u r familiar with my sql so alter the table and change the date time to date then only u can compare
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment