Forum Moderators: coopster

Message Too Old, No Replies

Export MYSQL selected rows

mysql, php, database, web

         

mrfori

4:23 am on Apr 27, 2004 (gmt 0)

10+ Year Member



Hi Guys

Any ideas on how to export selected rows from a mysql table into a schema.sql file?

I want to use mysqldump --opt database table but I don't wanna dump the whole table only results of a select.

PHPMyAdmin does it but I need to do it in shell script code.

thanks in advance

jatar_k

5:52 am on Apr 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



actually I was trying to figure that out tonight and just went with full dumps as the timeline was tight and it was a very large board.

I would be interested if anyone had thoughts.

jatar_k

6:01 am on Apr 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



now that i have some time to search I found this

--where='where-condition', -w 'where-condition'
Dump only records selected by the given WHERE condition. Note that quotes around the condition are mandatory if it contains spaces or characters that are special to your command interpreter.

"--where=user='jimf'" "-wuserid>1" "-wuserid<1"

from
[dev.mysql.com...]
near the bottom

mrfori

6:58 am on Apr 27, 2004 (gmt 0)

10+ Year Member



Thanks lot .. jatar_k .. let me try it right now

coopster

2:21 pm on Apr 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



A PHP script that outputs mySQL query [webmasterworld.com]
hehe, jatar_k must be getting older, mind is slipping ;)

jatar_k

4:44 pm on Apr 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



rofl, that is hilarious.

thanks for the good start to the morning coop. :)