Leo*_*ona -4 c# sql linq entity-framework
我有一些表:
table1:
id1
fk_tb2 // this is the fk to table2
table2:
id2
fk_tb3 //this is the fk to table3
table3:
id3
name3
Run Code Online (Sandbox Code Playgroud)
现在我想返回一个像:id1 fk_tb2 name3的表
谁知道怎么做?谢谢
问候,
连接表并使用匿名类型返回必填字段:
from t1 in table1
join t2 in table2 on t1.fk_tb2 equals t2.id2
join t3 in table3 on t2.fk_tb3 equals t3.id3
select new { t1.id1, t2.id2, t3.name3 }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1979 次 |
| 最近记录: |