在数据库执行以下命令,第二行是起始时间,第三行是结束时间。
/********************************************************/ set@mStartDateTime:="2001-07-2612:00:00"; set@mEndDateTime:="2019-03-0815:36:16"; set@mArtCount=(selectcount(*)fromdede_archives); set@mHours=(selectTimeStampDiff(HOUR,@mStartDateTime,@mEndDateTime)); set@mHours=FLOOR(@mHours/@mArtCount); updatedede_archivesset pubdate=UNIX_TIMESTAMP(FROM_UNIXTIME(pubdate)+INTERVAL(FLOOR(654+rand()*123))SECOND), senddate=UNIX_TIMESTAMP(FROM_UNIXTIME(senddate)+INTERVAL(FLOOR(654+rand()*123))SECOND); updatedede_archivesset dede_archives.pubdate=UNIX_TIMESTAMP(@mEndDateTime), dede_archives.senddate=UNIX_TIMESTAMP(@mEndDateTime); updatedede_archivesset dede_archives.pubdate=UNIX_TIMESTAMP(FROM_UNIXTIME(dede_archives.pubdate)-INTERVAL((@s:=@s+1)*@mHours/2)HOUR), dede_archives.senddate=UNIX_TIMESTAMP(FROM_UNIXTIME(dede_archives.senddate)-INTERVAL((@s:=@s+1)*@mHours/2)HOUR) orderbyiddesc,(SELECT@s:=-1); /********************************************************/