SELECT aaddr, auser, lname, fname, sname FROM adus, usr WHERE auser=usrid
ORDER BY aaddr, auser
INTO 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