Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL put data from two columns in one

Author  Topic 

Oli4
Starting Member

4 Posts

Posted - 2010-12-31 : 14:47:28
Hey,

I am very new at SQL language and trying to lear it. But I wonder how you can put data from two colums for example: Lastname en firstname of person into one field/one column with a space in between them.

Here today, gone tomorrow

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-12-31 : 15:36:35
[code]SELECT firstName + ' ' + lastName as fullName
FROM yourTable[/code]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-04 : 12:49:37
if nullable fields then:-

SELECT COALESCE(firstName + ' ','') + COALESCE(lastName,'') as fullName
FROM yourTable


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -