you can use the concat function: http://www.mysql.com/doc/en/String_functions.html
SELECT concat(vend_city,', ',vend_state,' ',vend_zip) FROM Vendors ORDER BY vend_name; > -----Original Message----- > From: Gilbert Wilson [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 2:42 PM > To: [EMAIL PROTECTED] > Subject: SQL Tutorial Trouble in MySQL > > > Hi all, > > I am following the lessons in Sams Teach Yourself SQL in 10 Minutes > using MySQL as the databse app. I am having some trouble > with Lesson 7: > Creating Calculated Fields where you are suppose to > concatenate several > fields. > > The Input looks like this: > > SELECT vend_city+', '+vend_state+' '+vend_zip > FROM Vendors > ORDER BY vend_name; > > The output should look like this: > > --------------------------------------------------------------- > Anytown , OH 44333 > Bear Town , MI 44444 > Dollsville , CA 99999 > New York , NY 11111 > London , N16 6PS > Paris , 45678 > > The output that I get is this: > > +-----------------------------------------+ > | vend_city+', '+vend_state+', '+vend_zip | > +-----------------------------------------+ > | 44333 | > | 44444 | > | 99999 | > | NULL | > | 11111 | > | NULL | > +-----------------------------------------+ > > According to the text: > > The solution is to concatenate the three columns. In SQL SELECT > statements, you can concatenate columns using a special operator. > Depending on what DBMS you are using, this can be a plus sign > (+) or two > pipes (||). > > Neither seem to work. > > Can anyone point me in the right direction? > > Thanks. > > Gilbert Wilson > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]