I would appreciate help in converting the following sql statement to 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
When I use Linqer (a wonderful program) I get the following error:
SQL cannot be converted to LINQ: Field [rn = row_number() over (partition by ClientId order by VisitId)] not found in the current Data Context.
Thanks in advance.
I don't think there is any corresponding feature in LINQ for row_number() over
, other than using Skip...Take
:
var q = (from v in Visit
join mv in vw_MasterView on v.VisitId equals mv.VisitId
orderby v.VisitId
select v).Skip(2).Take(1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.