开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜