Hi,
am having three tables (table_1 , table_2 and table_3)
1) table_1 having Foreign key for table_2 and table_3
2) table_2 and table_3 have no relationship
My question is ,
Is possible to join table_2 and table_3 with the table_1 ?
Am doing project in MVC4, trying to implement select statement.
Is there any sample project related to this kindly share it for Reference
Loading
Khan Abrar AhmedPosted Jun 11, 2015, 6:38 AM
declare @Table_2 as table(T2id int,value varchar(64))
declare @Table_3 as table(T3id int,value varchar(64))
insert into @Table_1 values(1,4,8),(2,3,6),(3,7,9)
insert into @Table_2 values(4,'T21'),(3,'T22'),(7,'T23')
insert into @Table_2 values(8,'T31'),(6,'T32'),(9,'T33')
select * from @Table_1 t1
inner join @Table_2 t2 on t1.Table2CID=t2.T2id
inner join @Table_2 t3 on t1.Table3CID=t3.T2id