New to Linq and was wondering if someone could someone please help me out with this linq query.
The "test2" seems to just return the number of items regardless if the "Status" is filtered. Am I doing something wrong? I'm trying to create a query that pulls multiple tables, groups them and make multiple counts. This is what I am starting with now and will
add the addition tables and counts as I get this to work.
from s in (
from t in Cars
join c in Clients on t.ClientId equals c.ID
select new {t, c}
) group s by new { s.t.ClientId } into g
select new
{
test1 = g.Select(x => x.c.Name),
test2 = g.Select(x => x.t.Status == "Sold").Count()
}
Thanks!