mysql - How to export DISTINCT data into DISTINCT files -


select *   `amc_info`  department =' (  select distinct department )  outfile = 'different department' 

i have huge data in amc_info , different department. 1 department may have more 1 row, total department more 30, want export data department-wise file name.

i think you're trying achieve:

select * outfile 'file.txt'  `amc_info` department in (select distinct department `amc_info`) 

check out select syntax too: https://dev.mysql.com/doc/refman/5.1/en/select-into.html

if you're trying distinct departments however:

select distinct department outfile 'file_name.txt' `amc_info` 

Comments