Why 2 CONCATs? Why not simply: mysql -Be "select CONCAT(host,'.',domain) from easyadmin.vsites where adminuser="davidtg"
Duncan ----------------------------------------------- Duncan Salada Titan Systems Corporation 301-925-3222 x375 -----Original Message----- From: Rob [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 8:20 AM To: David T-G; mysql users Subject: RE: formatting query output Try select CONCAT(CONCAT(LTRIM(RTRIM(host)),'.'), LTRIM(RTRIM(domain))) from ... The LTRIM and RTRIM will get rid of any white spaces you may have. If there aren't any then simply select CONCAT(CONCAT(host,'.'), domain) from ... --- Rob ************************** Rob Cherry mailto:[EMAIL PROTECTED] +27 21 447 7440 Jam Warehouse RSA Smart Business Innovation http://www.jamwarehouse.com ************************** -----Original Message----- From: David T-G [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 3:06 PM To: mysql users Subject: formatting query output -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, all -- I have a system info table: bash-2.05a$ echo 'describe easyadmin.vsites;' | mysql ... Field Type Null Key Default Extra sitenum int(11) PRI NULL auto_increment host varchar(250) domain varchar(250) quota bigint(12) 0 fp tinyint(4) 0 ssl tinyint(4) 0 php tinyint(4) 0 shell tinyint(4) 0 ssi tinyint(4) 0 cgi tinyint(4) 0 users int(8) 0 ipaddr varchar(15) webaliases text adminuser varchar(255) privatekey text csr text certificate text country char(2) state varchar(255) locality varchar(255) YES NULL organization varchar(255) orgunit varchar(255) commonname varchar(255) miva tinyint(4) 0 rawlog tinyint(4) 0 apachedirs text YES NULL suspended tinyint(4) 0 extrainfo text YES NULL I'd like to pull out the host and domain to get a list of sites: bash-2.05a$ echo 'select host,domain from easyadmin.vsites where adminuser="davidtg";' | mysql -N ... www justpickone.org www europasw.com www christiansciencect.org www justpickone.net www justpickone.com thenakedtruth justpickone.com www rovermechanic.com www christianscienceroswell.org www christianscienceroswell.net realtor justpickone.org www christianscienceroswell.com www bothamlysbotanicals.com www kellyandmisa.com www millmuseum.mus.ct.us www sector13.org www nda5150.com oaks justpickone.com rbpark justpickone.com robotca justpickone.org Furthermore, however, I'd like to format the output so that instead of www justpickone.org I can get www.justpickone.org so that I can plug the results directly into my simple little shell script (yeah, I could do this in perl and make the magic, but then I'd either have to call perl to make the query or rewrite the shell script, neither of which can make it onto my list today). Does mysql have a formatting option (other than -H, since HTML is the last thing I want) to allow me to define the output, perhaps in a manner similar to a printf string? TIA & HAND mysql query, :-D - -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE+S5gtGb7uCXufRwARAj+sAJ97v+7FzRVLWIlGCZgJLhI6vPSFRQCfSQDG 8kMeLJF2iv39ze3ZdD4d0iE= =PxhL -----END PGP SIGNATURE----- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php