I have my table structure like this.
ContinentTable => CountryTable => UserTable
User has CountryId. Country has ContinentId.
I want to query all the continents with the number of users in each.
I achieved this via SQL. But I want to use linq extension method since Im working with EF Core.
Here is my sql query
SELECT Continent.Id, Continent.Name, COUNT(Usr.UserName) AS 'User Count'
FROM Continents Continent, Countries Country, Users Usr
WHERE Continent.Id = Country.ContinentId
AND Country.Id = Usr.CountryId
GROUP BY Continent.Id, Continent.Name