27,581
社区成员




select b.Knowledge,c.LectureTitle,a.StudyNum
,(select COUNT(*) from studyDBNew.dbo.tblUserStudyRecord as r
where r.UserId = 'test' and r.LectureGuid = c.LectureGuid) as userNum
,(select LoreTitle+' ' from studyDBNew.dbo.tblLectureLore as i
left join studyDBNew.dbo.tblCourseLore as ii on i.LoreId = ii.CourseLoreId
where c.LectureGuid = i.LectureGuid for XML path('') ) as lore
,c.LectureContent,c.LectureId,a.aid,c.ToUrl2
from studyDBNew.dbo.tblCourseWare as a
left join studyDBNew.dbo.tblKnowledge as b on a.CourseWareGuid = b.CourseWareGuid
left join studyDBNew.dbo.tblLectures as c on b.KnowledgeGuid = c.KnowledgeGuid
where a.CourseWareId =628 and isnull(LectureId,'')<>'' order by b.Sort,c.Sort
SELECT * FROM
(SELECT
TOP 100 PERCENT ROW_NUMBER() OVER (ORDER BY b.Sort,c.sort) Row,
b.Knowledge,c.LectureTitle,a.StudyNum
,(select COUNT(*) from studyDBNew.dbo.tblUserStudyRecord as r
where r.UserId = 'test' and r.LectureGuid = c.LectureGuid) as userNum
,(select LoreTitle+' ' from studyDBNew.dbo.tblLectureLore as i
left join studyDBNew.dbo.tblCourseLore as ii on i.LoreId = ii.CourseLoreId
where c.LectureGuid = i.LectureGuid for XML path('') ) as lore
,c.LectureContent,c.LectureId,a.aid,c.Sort
from studyDBNew.dbo.tblCourseWare as a
left join studyDBNew.dbo.tblKnowledge as b on a.CourseWareGuid = b.CourseWareGuid
left join studyDBNew.dbo.tblLectures as c on b.KnowledgeGuid = c.KnowledgeGuid
where a.CourseWareId =628 and isnull(LectureId,'')<>'' )
TMP
WHERE Row>0 AND Row<=10
SELECT * FROM
(SELECT
TOP 100 PERCENT ROW_NUMBER() OVER (ORDER BY b.Sort,c.sort) Row,
b.Knowledge,c.LectureTitle,a.StudyNum
,(select COUNT(*) from studyDBNew.dbo.tblUserStudyRecord as r
where
-- r.UserId = 'test' and
r.LectureGuid = c.LectureGuid) as userNum
,(select LoreTitle+' ' from studyDBNew.dbo.tblLectureLore as i
left join studyDBNew.dbo.tblCourseLore as ii on i.LoreId = ii.CourseLoreId
where c.LectureGuid = i.LectureGuid for XML path('') ) as lore
,c.LectureContent,c.LectureId,a.aid,c.Sort
from studyDBNew.dbo.tblCourseWare as a
left join studyDBNew.dbo.tblKnowledge as b on a.CourseWareGuid = b.CourseWareGuid
left join studyDBNew.dbo.tblLectures as c on b.KnowledgeGuid = c.KnowledgeGuid
where a.CourseWareId =628 and isnull(LectureId,'')<>'' )
TMP
WHERE Row>0 AND Row<=10