Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Table1
 
ID   Legal Name   TypeFK.
1     S1            2
2     S2            1

Table2

ID   Type Name   
1     type1      
2     type2    

Required Result
ID     Legal Name   Type Name
1          S1        type2
2          S2        type1

how to use linq to get this ans...
Posted

Try this:
C#
var query  = from t1 in db.Table1
join t2 in db.Table2 on t1.ID equals t2.ID select new { t1.ID, t1.LegalName, t2.TypeName}

Refer this[^] for more information.


--Amit.
 
Share this answer
 
v2
Comments
suganyass 10-Sep-12 8:46am    
Thank U Amit..... :)
_Amy 10-Sep-12 8:50am    
Welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900