Created
April 28, 2014 08:37
-
-
Save shantanuo/11365613 to your computer and use it in GitHub Desktop.
script to generate dates in mysql starting from 1-Jan-11 till today
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mysql test -Bse"drop table myserial" | |
mysql test -Bse"create table myserial (ticketDate date, primary key (ticketDate))" | |
for myserial in {1..2000} | |
do | |
mysql -Bse"insert into test.myserial select date_add('2011-01-01', interval $myserial day)" | |
done | |
mysql -Bse"delete from test.myserial where ticketDate > curdate()" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment