-1

I have a dbcontext that contains 2 tables "Question" and "QuestionComments".I want to join them on Question.Id=QuestionComments.QuestionId and also wants to use where statement like Question.id=2

The equivalent SQL is:

SELECT * FROM Questions
INNER JOIN QuestionComments
ON Questions.Id=QuestionComments.QuestionId
Where Questions.Id=3163

1 Answers1

1

It should be something like this :

var result = from s in Questions
         join c in QuestionComments on s.Id equals c.QuestionId
         where s.id==3163
         select s;
Tomas Shelby
  • 43
  • 10