日期:2014-05-20  浏览次数:20747 次

linq to sql.
linq to sql 如何实现 sql 中左连接的效果

------解决方案--------------------
参考
------解决方案--------------------
var leftjoin = from p in ctx.Products

join c in ctx.Categories

on p.CategoryID equals c.CategoryID

into pro

from x in pro.DefaultIfEmpty()

select p.ProductName;
 


对应SQL:

SELECT COUNT(*) AS [value]

FROM [dbo].[Products] AS [t0]

LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t0].[CategoryID] = ([t1].[CategoryID])
 

------解决方案--------------------
UP
------解决方案--------------------
up
------解决方案--------------------
join
http://topic.csdn.net/u/20091108/00/ce4dd3fe-8498-419a-87d3-f9bc80644578.html