Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我直接通过 phpmyadmin 创建了一个日期表,我想将日期(yyyy:mm:dd)拆分为单独的日、月和年并插入单独的字段。任何人都可以帮助我直接在 phpmyadmin 中使用的查询来执行上述工作吗?
尝试:
UPDATE `table` SET `year` = YEAR(`date`), `month` = DATE_FORMAT(`date`, '%m'), `day` = DATE_FORMAT(`date`, '%d')
我使用DATE_FORMAT()而不是MONTH()和DAY()作为后两个删除前导零。
DATE_FORMAT()
MONTH()
DAY()