Mysql date format to match mysql records

I want to compare the date in mysql to some other date. Rather can formatting all the value in the database records to a specific date format and comparing it to a date value in where clause, I would like to keep the records in the format as they are and convert comparison date to the format that match the mysql record’s date format.

eg.
MySQL Record’s Date Format (for field created_at):
2007-11-24 17:50:27.0

Where clause Date format is:
YYYYMMDDHHMMSS

So, I need to make the where clause date format to mysql date format. How do I turn YYYYMMDDHHSS to YYYY-MM-DD HH:MM:SS.0? Also, I don’t know how to get SS.0?

Tried this in where clause, this wasn’t doing any good:
created_at = DATE_FORMAT(“%Y-%M-%d %H:%i:%s”,“200711070000”)

if the created_at column is defined as DATETIME then you just have to make sure that the value you want to compare it to is given in a way that mysql will recognize it as a datetime value

so WHERE created_at = 20071107000000

however, you do have another problem

if you want all the rows for a specific date, and your column values include a time portion, then you will need to do something like this:

WHERE created_at >= '2007-11-07'
  AND created_at  < '2007-11-08'

What if I want to do datetime comparison like:

created_at <= 20071231085434

I tried this, I don’t think it works.

how do you know it doesn’t work? it is one of the accceptable formats

me, i always use strings – ‘2007-12-31 08:54:34’

It works. I was missing couple of extra digits at the end.