I want to select distinct values for a column ‘language’, where the ‘project_ID’ is equal to a specific value, from a table called ‘screenshots’ in my database.
I know how to do this (but it gives me the distinct languages in the entire ‘screenshots’ table):
var result = db.screenshots.Select(m => m.language).Distinct();
How can I add a where clause to my query to ensure that I only get the distinct language values where the project_ID of that column is equal to a specific value?
In plain old SQL this would be the query I want to achieve:
select distinct language from screenshots
where projects_ID=31
Thanks
First you want to apply
whereclause, and thenselect distinct. Here it is in code