MySql:SELECT INTO OUTFILE, con UNION

← Torna a MySQL

fonte: https://dba.stackexchange.com/questions/19899/mysql-select-into-outfile-with-a-union

SELECT * FROM
((SELECT email FROM table WHERE createdate >= date_sub(now(), interval 1 year))
UNION DISTINCT
(SELECT email FROM table WHERE createdate < date_sub(now(), interval 1 year) AND email not like '%@gmail.com')) A
INTO OUTFILE '/tmp/emailDump.txt' FIELDS TERMINATED BY "," LINES TERMINATED BY "\n";