MySQL: Insert datetime into other datetime field

后端 未结 4 1067
误落风尘
误落风尘 2020-12-02 20:24

I have a table with a DATETIME column. I would like to SELECT this datetime value and INSERT it into another column.

I did this (note: \'2011-12-18 13:17:17\' is the

4条回答
  •  时光取名叫无心
    2020-12-02 20:46

    Try

        UPDATE products SET former_date=20111218131717 WHERE id=1
    

    Alternatively, you might want to look at using the STR_TO_DATE (see STR_TO_DATE(str,format)) function.

提交回复
热议问题