I have the following that returns all records that have a child.
var allStops = (from s in db.stop_details
where db.billing_transactions.Any(c=>c.stop_details_id == s.id)
orderby s.id
select s).ToArray();
I want to know all records that have exactly 3 children, like:
var allStops = (from s in db.stop_details
where db.billing_transactions.Any(c=>c.stop_details_id == s.id).Count() == 3
orderby s.id
select s).ToArray();
or
var allStops = (from s in db.stop_details
where db.billing_transactions.Count(c=>c.stop_details_id == s.id) == 3
orderby s.id
select s).ToArray();
I just can't seem to get the syntax correct...