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
 column to row

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2014-09-06 : 04:01:17
I have 2 tables to join.

select ID,FirstName,LastName,Gender from tableA
select ID,BabyFirstName,BabyLastName from tableB

how can I put the babyfirstname into the same row under Firstname from tableA after joining?

i tried this but the babyfirstname appear in new column.

select ID,FirstName,LastName,Gender, babyfirstname
from tableA a
join tableB b on a.id=b.id

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-09-06 : 07:02:28
[code]select a.ID, a.FirstName, b.babyfirstname, a.LastName, a.Gender
from tableA a
join tableB b on a.id = b.id[/code]


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

Go to Top of Page
   

- Advertisement -