A表字段 ID ,CreateID ,APPROVALUSERID
B表字段 UserID,Name
我想把A表中的所有ID都对应到B表的name 所以需要连3表查询 求大神教我语法
from t1 in A
from t2 in B
from t3 in B
from t4 in B
where t1.Id=t2.UserId and t1.CreateID =t3.UserId and t1.APPROVALUSERID=t4.UserId
select {}
这是内连接的写法。
不明白啥意思。是A表的三个ID 分别与B表的UserID连接,然后对应Name吗?
恩
@苟活的意义: var list = (from a in A join b in B on a.ID equals b.UserID select b).Union(from a in A join b in B on a.CreateID equals b.UserID select b).Union(from a in A join b in B on a.ApprovalUserID equals b.UserID select b);
试试吧,徒手写的。。
@jone_e: 我汗 我发现被那个答案给坑了,语法根本通不过