In PhpMyAdmin, go into the SQL tab and enter your query in there. Hit go, then click Export at the bottom of your results. You can select to export as a CSV.
In case you're interested, here's how to do it via SQL without PMA: How to output MySQL query results in CSV format?