Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL LINQ
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 3-Jan-13 1:22am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 645
1 OriginalGriff 335
2 CPallini 250
3 PIEBALDconsult 150
4 Fredrik Bornander 130
0 OriginalGriff 5,835
1 Sergey Alexandrovich Kryukov 5,198
2 CPallini 4,740
3 George Jonsson 3,167
4 Gihan Liyanage 2,470


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100