SQL查询转换与实体框架

时间:2013-07-16 10:30:17

标签: entity-framework-4

以下是Country和State命名的两个表,我只是想知道 下面使用C#或Vb.Net对Lambda Expression中的Entity Framework进行SQL查询。

SELECT dbo.Country.CountryID, dbo.Country.CountryName, dbo.State.StateName
FROM dbo.Country
     INNER JOIN dbo.State ON dbo.Country.CountryID = dbo.State.CountryID

1 个答案:

答案 0 :(得分:3)

from p in context.country 
join q in context.state on p.CountryID == q.CountryID
select new { p.CountryID,p.CountryName,q.StateName }