mssql 2008 R2 を使用しています
以下の構造を持つ
create table #Profile (pro_id int,surname varchar(30),firstname varchar(30))
insert #Profile
select 1,'John', 'James'
create table #Qualification (pro_id int,Degree varchar(30),School varchar(30),Year int)
insert #Qualification
select 1 ,'LLB' ,'Yale University' , 2001
union
select 1, 'MBA', 'Wharton university', 2002
create table #Projects (pro_id int,Title varchar(30),Year int)
insert #Projects
select 1 , 'Excavation of aquatic debris', 2007
union
select 1 , 'Social Networking', 2003
union
select 1 , 'Excavation of aquatic debris', 2007
以下のように出力したい
1 John James MBA Wharton university 2002, LLB Yale University 2001 Social Networking 2003, Excavation of aquatic debris 2007,
すべてのデータを取得でき、カンマ区切りの o/p でスタック
select p.pro_id,p.firstname,p.surname,--q.*,pr.*
q.Degree +' '+ q.School ,q.Year ,
pr.Title,pr.Year
from #Profile p
inner join #Qualification q
on p.pro_id = q.pro_id
inner join #Projects pr
on p.pro_id = pr.pro_id
これを達成するための指針