At 4:22 PM -0500 6/6/03, Paul DuBois wrote:
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));

NICE! Thanks for the fast response!


I was trying to use LEFT and other Functions to achieve it.
--
<--------------------------------------------------------------->
    Alex Pilson
    FlagShip Interactive, Inc.
    [EMAIL PROTECTED]
    404.642.8225 CELL
<--------------------------------------------------------------->

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



Reply via email to