List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 17 2001 1:23am
Subject:Re: Next Newbie Question
View as plain text  
At 5:54 PM -0700 7/16/01, Bob Rea wrote:
>Still reading SQL in 10 Minutes, and here is the next problem, string
>concatenation in SELECT queries. The book has this query and this
>result. The other data is there in the table.
>
>mysql> select vend_city+', '+vend_state+' '+vend_zip
>     -> from Vendors
>     -> order by vend_name
>     -> ;
>+----------------------------------------+
>| vend_city+', '+vend_state+' '+vend_zip |
>+----------------------------------------+
>|                                  44333 |
>|                                  44444 |
>|                                  99999 |
>|                                  11111 |
>+----------------------------------------+
>4 rows in set (0.01 sec)
>
>How do I do this in MySQL?

If + means concatenation, then try:

CONCAT(vend_city, ', ', vend_state, ' ', vend_zip)

>
>Alternatively, can anyone suggest a good tutorial for MySQL online
>that covers the topics the book does? The book's web site is at
>http://www.forta.com/books/0672316641/

I'd suggest reading chapter 5 of the MySQL Reference Manual to get
an idea of the differences between MySQL's SQL and other SQLs.  That'll
give you some information about converting queries for MySQL.

>
>--
>Bob Rea


-- 
Paul DuBois, paul@stripped
Thread
Next Newbie QuestionBob Rea17 Jul
  • Re: Next Newbie QuestionKen Sommers17 Jul
  • Re: Next Newbie QuestionPaul DuBois17 Jul
  • RE: Next Newbie QuestionChris Bolt17 Jul