English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

col1, col2, col3 being returned all together as one collection of one name.

2007-07-18 02:50:54 · 3 answers · asked by SEAN W 2 in Computers & Internet Programming & Design

Example:
table
Col1 col2 col3
john smith jr
sally smith sr

result
ColAlias
john
sally
smith
smith
jr
sr

2007-07-18 03:01:45 · update #1

3 answers

For Oracle databases, it would go something like:

SELECT First_Name || ' ' || Middle_Initial || ' ' || Last_Name AS Employee
FROM emp;

"Employee" would be your alias.
"First_Name", "Middle_Initial", and "Last_Name" would be your concatenated columns.

2007-07-18 04:13:36 · answer #1 · answered by knight1357 2 · 0 0

select col1+' '+col2+' '+col3 as FullName
from table
where condition

That should work in SQL Server

2007-07-18 10:02:45 · answer #2 · answered by Vera 5 · 0 0

Then you need to select col1||col2||col3
That should do it. If it does not then look fro concatenation for your database.

2007-07-18 09:56:32 · answer #3 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers