How to export mysql database based on a where condition
Using SQL from the mysql command-line:

SELECT * from YOURTABLE
WHERE status=0 and id&gt;20
INTO OUTFILE 'yourtable.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';


or using mysqldump with the --where= option:

mysqldump -u youruser -p yourdbname yourtablename --where="status=0 and id&gt;20"&gt;yourtable.sql


Using phpMyAdmin you can execute the query in the GUI &amp; click "export" under the resultset.