MY SQL (Select into file)

Output result from MYSQL database to a file, including a where and join



SELECT achievements_to_projects.month,achievements_to_projects.percentage,achievements_to_projects.quantum,achievements_to_projects.phase,projects.name,achievements.achievement
FROM achievements_to_projects
INNER JOIN projects on achievements_to_projects.project = projects.id
INNER JOIN achievements on achievements.id  =  achievements_to_projects.achievement
INTO OUTFILE '/var/lib/mysql/achievements.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

No comments:

Post a Comment