views:

61

answers:

2

How can I produce something like this with Linq? I'm trying to work something out, this is related to my other post, but my distinct keeps coming back with more rows than expected

http://stackoverflow.com/questions/3533629/add-conditional-join-dynamically-with-linq

select distinct c.CompanyID, c.CompanyName from Company c
left join CompanyIndustry ci
on c.companyid = ci.companyid
left join CompanyService cs
on c.CompanyID = cs.CompanyID
where cs.ServiceID = 6 and ci.IndustryID = 4
+1  A: 

You should use GROUP BY Not distinct

JonH
+2  A: 

If your companyID has more than one related industry or service, you'll get more than one row per company.

Beth