一个主表A(a1,a2),子表B(a1,b1,b2) ,想得到的结果是 [{a1,a2,Info [{b1,b2},{b1,b2},...}]]
var list=
from a in A
join b in B on a.a1=b.a1
group b by a into g
select new {
g.key.a1,
g.key.a2,
Info=g.select (c=>new {c.b1,c.b2}).ToList()
}.tolist()
2023-08-11 18:53:16
一个主表A(a1,a2),子表B(a1,b1,b2) ,想得到的结果是 [{a1,a2,Info [{b1,b2},{b1,b2},...}]]
var list=
from a in A
join b in B on a.a1=b.a1
group b by a into g
select new {
g.key.a1,
g.key.a2,
Info=g.select (c=>new {c.b1,c.b2}).ToList()
}.tolist()