Skip to content

Instantly share code, notes, and snippets.

@reyesyang
Created February 25, 2014 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reyesyang/9205367 to your computer and use it in GitHub Desktop.
Save reyesyang/9205367 to your computer and use it in GitHub Desktop.
Export MySQL query result to CSV file
SELECT id, username, (total_point - spent_point) AS point
FROM users
ORDER BY point DESC
LIMIT 50
INTO OUTFILE '/tmp/bbs_points_top50.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment