Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I want to convert below sql to linq, Multiple on clause in join statements
select * from dbo.Table1              	 
LEFT OUTER JOIN dbo.Table2 AS Table2                     	 
INNER JOIN dbo.Table3 AS Table3 ON Table3.Id = Table2.LnId 
 ON Table2.Id = Table1.Column1 

This is my linq Statement
 from Table1 in ctxk.Table1
join Table2 in ctx.Table2 on  equals  into ExternalPerson_join
from Table2 in ExternalPerson_join.DefaultIfEmpty()
join Table3 in ctxk.Table3 
on  new 
{ 
aid = Table2.LnId, 
bid = Table2.Id  
}	
	equals 
	new 
	{
	aid = Table3.Id, 
	bid = Table1.LnId   
	}
select new {
  Table1,
  Table2,
  Table3
}


linq statement raises error
"Invalid expression term 'equals'
Expected contextual keyword 'equals'"

How to fix it

Thank you
Posted

1 solution

Hi,

See the following links for your solution.

multiple tables join by Linq
linq join 3 tables with or condition

This will help you to find out your solution.

Thanks
 
Share this answer
 

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