1.正常查询
SELECT a.emp_no '员工号',b.seq '文章序号' from vote_records a INNER JOIN vote_content b ON a.vote_content_id = b.id
| 90150967 | 19 |
| 90150967 | 5 |
| 90150967 | 6 |
| 90150967 | 7 |
| 90150967 | 8 |
| 90150967 | 20 |
| 90150967 | 15 |
| 90150967 | 12 |
2.导出csv查询
SELECT a.emp_no '员工号',b.seq '文章序号' from vote_records a INNER JOIN vote_content b ON a.vote_content_id = b.id into outfile '/home/mysql/2020123103.csv';
两列数据合并到一列了
3.导出csv以空格分开
SELECT a.emp_no '员工号',b.seq '文章序号' from vote_records a INNER JOIN vote_content b ON a.vote_content_id = b.id into outfile '/home/mysql/2020123103.csv' fields terminated by ' ';
4.导出csv以列分隔
SELECT a.emp_no '员工号',b.seq '文章序号' from vote_records a INNER JOIN vote_content b ON a.vote_content_id = b.id into outfile '/home/mysql/2020123104.csv' fields terminated by ',';