LINQ - Left join in Linq - Asked By sunny C on 28-Nov-12 11:05 AM

Hi All,

I am trying to get a datatable from two datatables. I am new to linq to sql. So can you please let me know what query should I write to get this done.

DataTable1:

Col1 Col2 Col3 Col4 Col5
1 A Test letter AA1
1 A Test mail AA2
2 B NewTest letter BB1
2 B NewTest mail BB2
3 C LatestTest1   CC1
4 D LatestTest2   DD1
5 E LatestTest3   EE1

DataTable2:

Col1 Col2 Col3
1 Test letter
2 NewTest mail

Result DataTable:

Col1 Col2 Col3 Col4 Col5
1 A Test letter AA1
2 B NewTest mail BB2
3 C LatestTest1   CC1
4 D LatestTest2   DD1
5 E LatestTest3   EE1


Thanks in advance.

Regards,
Sunny
Hemanth Kumar replied to sunny C on 03-Dec-12 04:27 AM
Hi Sunny,

Yes we can write SQL Query in LINQ for Left join also.Please check this link
http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/