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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Case

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-15 : 11:07:37
New to SQL writes "SQL SERVER 2005 VISUAL STUDIO

I have two columns of data from two different tables.

I need them combined in one,


Column one Column two

London Null
Manchester Null
Kent Null
Null London
Null Kent


So that when its null in column one it uses the data in column two

THANKS"

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-15 : 11:16:27
select coalesce(col1,col2)


www.elsasoft.org
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-01-15 : 11:18:00
select isnull(ColumnOne, ColumnTwo) as CombinedColumn
from MyTable




Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-16 : 07:19:52
quote:
Originally posted by AskSQLTeam

I have two columns of data from two different tables.
If the data is in two tables, you must have some column telling which item number the city is, some sort of sort order.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -