At 17:17 -0400 6/6/03, Alex Pilson wrote:
I have an old table that has about 2000 records and hasn't been modified. I realized it was missing a create_date. Do anyone know or have any slick SQL code to extract out the date from the timestamp field and update and insert the date into the create_date field?

Thanks!
--
<--------------------------------------------------------------->
    Alex Pilson
    FlagShip Interactive, Inc.
    [EMAIL PROTECTED]
    404.642.8225 CELL
<--------------------------------------------------------------->

FROM_DAYS(TO_DAYS(t)) will strip out the time part and convert a DATETIME or TIMESTAMP value to a DATE. So you could do this:

UPDATE tbl_name SET create_date = FROM_DAYS(TO_DAYS(timestamp_field));

--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to