我对linq很新,并且在将以下sql转换为linq时遇到问题:
select
c3.COURSE, c3.DESCR
from
(select c.courseprefix, MAX(c.coursesuffix) [coursesuffix]
from
(select distinct SUBSTRING(course,1,3)[courseprefix], RIGHT(course, LEN(course) - 3) [coursesuffix]
from PsCourses where LEN(course) >= 3 ) c
group by c.courseprefix
) c2 inner join PsCourses c3 on (c2.courseprefix + c2.coursesuffix) = c3.COURSE
where
c3.COURSE_STATUS = 'A'
order by
c3.course
答案 0 :(得分:2)
好吧,你可以使用http://www.sqltolinq.com/downloads 或者你可以创建一个IQueryable,但在我的个人标准中,我更喜欢用本机sql写的复杂查询