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
 combine to 1 new column

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-12-18 : 02:21:02
I have data as below:

ID Journey Segment Type Depart Arrive 1st 2nd
12345 1 1 A UK AUS UK NULL
12345 1 2 A AUS US NULL US

How can i make it to 1 row for 1st and 2nd column?

ID 1st 2nd
12345 UK US

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-12-18 : 02:47:05

select ID, max([1st]), max([2nd])
from yourtable
group by ID



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-12-18 : 02:55:44
thanks.got it.
Go to Top of Page
   

- Advertisement -