SELECT aaddr, auser, lname, fname, sname FROM adus, usr WHERE auser=usrid ORDER BY aaddr, auserINTO OUTFILE '/tmp/users.csv'FIELDS TERMINATED BY ','ENCLOSED BY '"' LINES TERMINATED BY '\n';
або
mysql-user-pass-e"select cols from table where cols not null">/tmp/output