Reputation: 3909
Is there a way in MySQL to concatenate text to values using a SELECT statement? (like in Oracle)
For example, in Oracle you can write something like this:
SQL> select 'The Year is '|| year, 'The month is '|| month from time where rownum < 2;
'THEYEARIS'||YEAR
----------------------------------------------------
'THEMONTHIS'||MONTH
-----------------------------------------------------
The Year is 2009
The month is 1
Upvotes: 10
Views: 27451
Reputation: 12824
There is a CONCAT function in mysql.
select concat('The Year is ', year), concat('The month is ', month) from time where rownum < 2;
Upvotes: 4
Reputation: 40717
SELECT Concat(vend_name, ' (', vend_country, ')')
FROM vendors
ORDER BY vend_name;
Read this tutorial:
http://www.brainbell.com/tutorials/MySQL/Concatenating_Fields.htm
Upvotes: 21