TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
New Bee
NA
52
1.6k
Need help doing a Group count with a join
Jul 3 2019 12:37 PM
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"
)),
// Need to Count the number of Cars that were Sold and is Color blue (lets say for example and where Color is another table)
CountSoldByColor =
}
Reply
Answers (
3
)
comma separated values
Check Id exists in websevice method content