qinHaiXiang
qinHaiXiang

Reputation: 6429

MySql, Is it a way to export/import data from date to date?

In my way, I just want to export the data of a week and used it to update somewhere else.

I am new to MySql. So, can I do it by the PHP code written by myself or using other software?

Upvotes: 0

Views: 5985

Answers (2)

chandoo
chandoo

Reputation: 1316

Go to phpmyadmin write the sql select statement where date between from and to. then in the result page below the results n in the section of "Query results operations" you will find export button click the button to get the data to be exported.

Upvotes: 4

Marc B
Marc B

Reputation: 360812

If you're using mysqldump, you can use the --where option to limit data ranges:

mysqldump -p -u username DATABASE table --where="datefield >= 'start date' AND datefield <= 'end date')

There's also the OUTFILE option:

SELECT INTO OUTFILE '/name/of/dump/file' ...

otherwise, it's just a matter of building the appropriate query in MySQL, looping over the result set, and dumping the data into a file from which you can extract the data again somewhere else.

Upvotes: 1

Related Questions