LINQ Show every Record from table A exactly once when it exists at least once in Table B
I have to tables, Table A is master,开发者_如何学运维 table B child.
What is the simplest LINQ2SQL Query to show all records from Table A exactly once that have at least a child in table B?
Something like:
var AsWithBs = db.TableA.Where(x => x.Bs.Any())
or
var AsWithBs = from a in db.TableA
where a.Bs.Any()
select a;
var q = (from record in database.records where record.children.Any()).Distinct();
精彩评论