I have 3 tables t1(F1,F2,F3), t2(F2,F4) & t3(F1,F5)
create table #t1(F1 varchar(10),F2 varchar(10),F3 int)
create table #t2(F1 varchar(10),F4 varchar(10))
create table #t3(F2 varchar(10),F5 varchar(10))
Insert into #t1 ('aa','bb',3)
Insert into #t1 ('dd','bb',17)
Insert into #t1 ('gg','cc',36)
Insert into #t1 ('jj','dd',24)
Insert into #t2 ('bb','BBBB')
Insert into #t2 ('cc','CCCC')
Insert into #t2 ('dd','DDDD')
Insert into #t3 ('aa','ZZZZZ')
Insert into #t3 ('aa','YYYYY')
Insert into #t3 ('gg','XXXXX')
Insert into #t3 ('jj','WWWWW')
Insert into #t3 ('jj','VVVVV')
What I want as the results:
aa bb BBBB ZZZZ,YYYY 3
dd bb BBBB NULL 17
gg cc CCCC XXXXX 24
jj dd DDDD WWWWW,VVVVV 3
My Query So far
Select #t1.F1, #t1.F2, #t2.F4, ........... , #t1.F3
From #t1
inner join #t2 on #t1.F2 = #t2.F2
inner join #t3 on #t1.F1 = #t3.F1
Please help me to build the query
Srinika