This is similar to another question (http://stackoverflow.com/questions/935556/mysql-dump-by-query) but I hope different enough.
I want to export a specific items from a db table so I can back it up for possible future restoration.
I'm already using something like this from another table...
mysqldump --user="user" --password="password" --opt -w"id=1" databasebname tablename
But now I need something more complex.
I have the following query that I need to use to generate the export data...
SELECT tbl2.*
FROM tbl1, tbl2
WHERE tbl2.parent = tbl1.child
AND tbl1.id = 1
Can I do this with mysqldump?
Or do I need to think of a different approach?
(If it helps, this is all being done from within a bash script)