0

For some reason I am getting a syntax error on the below code. What I am trying to achieve is A LEFT JOIN with MULTIPLE JOIN CLAUSES. The syntax error occurs at the Keyword INTO foobar. VS 2012 says unexpected Token. Any help would be great, thank you !

 Dim results = From f In foo _
                   Join b In bar On new with {f.Type,f.ID} Equals New With {"Test",b.ID} into fooBar _
                   from x in foobar.DefaultEmpty() _ 
                   Where foo.id = 1

2 Answers 2

1

You want a Group Join:

Dim results = From f In foo _
               Group Join b In bar On 
                   New With {f.Type,f.ID} Equals New With {"Test",b.ID} _
                   Into fooBar = Group _
               from x in foobar.DefaultEmpty() _ 
               Where foo.id = 1
Sign up to request clarification or add additional context in comments.

2 Comments

@D Stanley, why would the have a Group Join msdn says it does the same thing as a left join. What is the difference and why does it work for me?
@gh9 That's the syntax VB uses - it has some other uses besides the equivalent of a LEFT JOIN (such as being able to select aggregates of the right hand side) so I guess they chose a more generic syntax.
0

Try to cast the f.ID or b.ID

 Dim results = From f In foo _
                   Join b In bar On new with {f.Type, CInt(f.ID)} Equals New With {"Test", CInt(b.ID)} into fooBar _
                   from x in foobar.DefaultEmpty() _ 
                   Where foo.id = 1

1 Comment

@ still get the unexpected token error right before INTO keyword

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.