SELECT * FROM (
SELECT 'creativeID' AS creativeID,'userID' AS userID,'positionID' AS positionID,'clickTime' AS clickTime,'conversionTime' AS conversionTime,'connectionType' AS connectionType,'telecomsOperator' AS telecomsOperator,'appPlatform' AS appPlatform,'sitesetID' AS sitesetID,'positionType' AS positionType,'age' AS age,'gender' AS gender,'education' AS education,'marriageStatus' AS marriageStatus,'haveBaby' AS haveBaby,'hometown' AS hometown,'residence' AS residence,'appID' AS appID,'appCategory' AS appCategory,'label' AS label
UNION ALL
SELECT
creativeID,userID,positionID,clickTime,conversionTime,connectionType,telecomsOperator,appPlatform,sitesetID,positionType,age,gender,education,marriageStatus,haveBaby,hometown,residence,appID,appCategory,label
from t_uniondata
limit 0,1000000
) as a into outfile '/var/lib/mysql-files/data1.csv' FIELDS TERMINATED BY ',' lines terminated by '\n';
SELECT 'creativeID' AS creativeID,'userID' AS userID,'positionID' AS positionID,'clickTime' AS clickTime,'conversionTime' AS conversionTime,'connectionType' AS connectionType,'telecomsOperator' AS telecomsOperator,'appPlatform' AS appPlatform,'sitesetID' AS sitesetID,'positionType' AS positionType,'age' AS age,'gender' AS gender,'education' AS education,'marriageStatus' AS marriageStatus,'haveBaby' AS haveBaby,'hometown' AS hometown,'residence' AS residence,'appID' AS appID,'appCategory' AS appCategory,'label' AS label
UNION ALL
SELECT
creativeID,userID,positionID,clickTime,conversionTime,connectionType,telecomsOperator,appPlatform,sitesetID,positionType,age,gender,education,marriageStatus,haveBaby,hometown,residence,appID,appCategory,label
from t_uniondata
limit 0,1000000
) as a into outfile '/var/lib/mysql-files/data1.csv' FIELDS TERMINATED BY ',' lines terminated by '\n';