This is a migrated thread and some comments may be shown as answers.

Join with multiple conditions

3 Answers 106 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
stavros sotirchos
Top achievements
Rank 1
stavros sotirchos asked on 29 Oct 2010, 05:51 PM
Is it possible to do a join with multiple conditions? I have tables with multiple columns as keys and although I've tried to to join with multiple conditions I failed. Below I show some of the ways I've tried and failed with exceptions...

Try 1

from a in table1 
join b in table2 on new {a.code, a.aa} equals new {b.code, b.aa}
join c in table3 on b.id equals c.id
where ....


Try 2

from a in table1
from b in table2
from c in table 3
where a.code == b.code && a.aa == b.aa && b.id == c.id
...

Try 3 

from a in table1
from d in (  from b in table2 join c in table3 on b.id equals c.id select new {t1 = b, t2 = c})
where a.code = d.t1.code && a.aa == d.t1.aa
...

3 Answers, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 03 Nov 2010, 08:17 PM
Hi stavros sotirchos,

 We are experiencing some issue regarding more complex join situation such as yours. We are working on improving this. However the fix might not be included in the following release. We will add these scenarios in our test suite and work on them after the Q3 release. 

However for the time being, can you please give us a little more insight on what you are trying to accomplish as surely this query could be split into two (or more) simpler queries that would execute. 

I am looking forward to resolving this issue and I am sorry for any inconvenience caused.

Greetings,
Serge
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bassel
Top achievements
Rank 1
answered on 08 Feb 2011, 03:37 PM
Hi
I'm using Q3 2010
and I have the same problem
the Composite Key Join is not working
it give an exception when compiling says error in join clause

0
Serge
Telerik team
answered on 10 Feb 2011, 03:37 PM
Hello Bassel,

 Could you please elaborate a bit more on you case as I cannot reproduce this behaviour at the moment. Are you using the designer and if so are you reverse mapping or just creating your model through it. 

What is the exact message of the exception you are seeing and if there is no exception please share with us the output of the build process. If it is not too much trouble I would ask you to open a separate support thread and send us your project there so that we can further investigate this issue. 

I am looking forward to resolving this problem. 

Kind regards,
Serge
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
LINQ (LINQ specific questions)
Asked by
stavros sotirchos
Top achievements
Rank 1
Answers by
Serge
Telerik team
Bassel
Top achievements
Rank 1
Share this question
or