Basically i want this as query:
SELECT DISTINCT c.description FROM students s
join courses c on s.courseId = c.Id
WHERE c.Id = 100
How do i do this in EF Core? When i do :
db.Students
.Include(s => s.courseId)
.Select( -- how can i select for course description? --)
.Distinct()
Bear with me. I am new to Entity Framework.
First of all, your Include expression handles the joining for you, so you don't have to specify how your going to join the table. So your include will look like this:
_db.Students.Include(s => s.Course)
Then you'd accomplish your select through the use of a lamba expression like this:
_db.Students .Include(s => s.Course).Select(s => s.Course.Description).Distinct()