tags:

views:

36

answers:

1

I want to be able to do something like this

SELECT `first_name` + " " + `last_name` as `whole_name` FROM `users`

So basically I get one column back whole_name which is first_name and last_name concatenated together with a (space).

How do I do that in SQL, or more specifically, MySQL ?

Thanks

+6  A: 

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws

SELECT CONCAT_WS(" ", `first_name`, `last_name`) AS `whole_name` FROM `users`
Borealid
+1: CONCAT would work just fine too: `CONCAT(first_name, ' ', last_name) AS whole_name`
OMG Ponies