【发布时间】:2012-05-18 00:13:12
【问题描述】:
如果能帮助我将以下 sql 语句转换为 linq,我将不胜感激:
select *
from (
select
*,
rn = row_number() over (partition by ClientId order by VisitId)
from
Visit
) activityWithRn
inner join vw_MasterView on vw_MasterView.VisitId = activityWithRn.VisitId
where activityWithRn.rn =3
当我使用 Linqer(一个很棒的程序)时,我收到以下错误:
SQL cannot be converted to LINQ: Field [rn = row_number() over (partition by ClientId order by VisitId)] not found in the current Data Context.
提前致谢。
【问题讨论】:
-
您没有提及您使用的是哪个 ORM,但如果您使用的是实体框架,您可以继续使用带有 ExecuteStoreQuery 的 SQL - msdn.microsoft.com/en-us/library/dd487208.aspx
标签: c# sql-server-2008 visual-studio-2010 linqer