LINQ to SQL之内链接,左链接,右链接
时间:2010-11-04 来源:Adam哥
示例如下:
var query = from tb0 in db.table_0
join tb1 in db.table_1 on table_0.关联键 equals table_1.关联键
select new { ... };
左链接或右链接,使用DefaultIfEmpty()语法,采用些语法前需要用到into语法
示例如下:
var query2 = from tb0 in db.table_0
join tb1 in db.table_1 on table_0.关联键 equals table_1.关联键
into all
from tb2 in all.DefaultIfEmpty()
select new { ... };
相关阅读 更多 +