Hi all, I hope someone could help me out with this linq query.
I am new to Linq and having a hard time figuring out how to do the
CountSoldByColor. What I need is to be able to do the count where from the grouped items and alo include a join table Color where the Name of the color is say "blue".
If you need more info please don't hestiate to ask. Thanks in advance!
Cars
----
ID
ModelID
Year
Status
Color
----
ID
CarID
Name
- from s in
- (
- from t in Cars
- select new { t }
- ) group s by new { s.t.ModelID, s.t.Year } into g
-
- select new
- {
- Model = (from k in Models where k.ID == g.Key.ModelID select k.Name),
- Year = g.Key.Year,
- CountSold = g.Count(p => (p.t.Status == "Sold")),
-
- CountSoldByColor =
- }