View Single Post
  #2   IP: 112.87.30.158
Old 2015-04-18, 11:05 PM
Keweenaw Keweenaw is offline
初级会员
 
Join Date: 2007-01-11
Posts: 1
Keweenaw 现在声名狼藉
Default

Here is a better way to do that:

Code:
UPDATE tablename SET datefield= ‘2005-01-01′ + interval rand()*883
where ‘2005-01-01′ is the base date and 883 is the number days (maximum) you can go past the base date.

This will fill in each rows datefield with a random date between 2005-01-01 and 2006-06-02.

Hope that helps!
Reply With Quote