Skip to main content
Inspiring
February 4, 2008
Answered

Combining Two Columns Into One

  • February 4, 2008
  • 3 replies
  • 435 views
Hi guys,

Is it possible for a query to combine two columns into one? For example, lets say I have the following query:

SELECT ID, FIRST_NAME, LAST_NAME
FROM EMPLOYEES

I'd like the output to have two columns: one containing the ID and the other containing FIRST_NAME followed by a space followed by LAST_NAME. I know how to do this outside of the query using coldfusion, but it would save me a lot of work if there is some way the query could do it for me.
This topic has been closed for replies.
Correct answer Newsgroup_User
Yes but the concatenation operand varies somewhat from one database
management system to another.

In Oracle it would look something like this IIRC.

SELECT ID, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME
FROM EMPLOYEES

3 replies

MagikaruAuthor
Inspiring
February 4, 2008
Great! Just what I was looking for. Thanks.
Inspiring
February 4, 2008
For Microsoft SQL Server

SELECT ID, FIRST_NAME + ' ' + LAST_NAME AS FULL_NAME
FROM EMPLOYEES
Newsgroup_UserCorrect answer
Inspiring
February 4, 2008
Yes but the concatenation operand varies somewhat from one database
management system to another.

In Oracle it would look something like this IIRC.

SELECT ID, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME
FROM EMPLOYEES