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?
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?
var q = (from record in database.records where record.children.Any()).Distinct();
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;