I have 2 tables (Topics and Comments) in an MVC application. I would like to query the comments table, but also return the title from the topic table.
I believe I’m using EF. I would use SQL, but I’m not sure if that is possible for an MVC application.
Using SQL I would do the following:
SELECT c.Id, c.Comment, t.Title
FROM Comments c INNER JOIN Topics t
ON c.TopicId = t.Id
Any help is appreciated.
This is how your sql query is written using LINQ: