开发者

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

开发者 https://www.devze.com 2023-01-16 11:27 出处:网络
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 my开发者_JAVA百科self or using other software?G

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 my开发者_JAVA百科self or using other software?


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.


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.

0

精彩评论

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