1

This is my linq query -

from u in db.CardTables
   join v in db.FunRegistereds
   on new { u.IsApproved, u.FKCardID } equals new {"YES", v.UserID }

Where from this query column in first table CardTables has one with string match and column FKCardID is integer type.

I am getting troubled with this first string match.

How do I match this u.IsApproved column with string "YES" while matching both the columns in this way ??

2 Answers 2

4

Join on FKCardID equals UserID and just filter u.IsApproved:

from u in db.CardTables
join v in db.FunRegistereds
   on u.FKCardID equals v.UserID
where u.IsApproved == "YES"
...
Sign up to request clarification or add additional context in comments.

1 Comment

@p.s.w.g thanks, actually I was thinking about your solution :) But decided not to join on query parameter - and added filtering instead :)
3

You need to give names to the properties in the second anonymous type initializer:

from u in db.CardTables
join v in db.FunRegistereds
on new { u.IsApproved, u.FKCardID } equals 
   new { IsApproved = "YES", FKCardID = v.UserID }

Comments

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.