简体   繁体   中英

mysql update value from another column in the same table

I have a table with these 2 columns : date and day date has dates and day is empty I would like to do something like this :

UPDATE table SET day='day(date)' 

the idea is to take the date (its in date time format) and take out the day and insert it into the day column. any ideas ?

希望这会有所帮助

UPDATE table SET day = EXTRACT(DAY FROM date)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM