开发者

Update 'ZERO' DATETIME values in MySQL

Trying to update mysql rows that have DATETIME value of 0000-00-00 00:00:00 to a new date.

UPDATE wp_posts SET post_date = FROM_UNIXTIME(UNIX_TIME开发者_C百科STAMP('2011-05-02'))
and post_date_gmt = FROM_UNIXTIME(UNIX_TIMESTAMP('2011-05-02')) 
WHERE post_date = 0 LIMIT 100

This updates 0rows, when there are thousands with 0000-00-00 00:00:00 value.


UPDATE wp_posts SET post_date = FROM_UNIXTIME(UNIX_TIMESTAMP('2011-05-02')),
       post_date_gmt = FROM_UNIXTIME(UNIX_TIMESTAMP('2011-05-02'))
       WHERE post_date ="0000-00-00 00:00:00" 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜