- 最后登录
- 2014-3-14
- 在线时间
- 3 小时
- 威望
- 26
- 金钱
- 115
- 注册时间
- 2012-7-13
- 阅读权限
- 10
- 帖子
- 10
- 精华
- 0
- 积分
- 26
- UID
- 608
|
2#
发表于 2012-7-13 22:58:15
本人修改后SQL语句
SELECT /*+ INDEX_JOIN(LUC) */ NVL(STU.STUD_AREA, ' ') AS STUD_AREA,
NVL(STU.COMPANY, ' ') AS COMPANY,
NVL(STU.LMS_NO, ' ') AS LMS_NO,
NVL(STU.MOBILE_NO, ' ') AS MOBILE_NO,
NVL(STU.EMAIL, ' ') AS EMAIL,
LSR.USER_NAME AS FIELD1,
NVL(LSR.GROUP_NAME, ' ') AS FIELD2,
NVL(LSR.ACT_POINT01, ' ') AS FIELD3,
NVL(LSR.ACT_POINT02, ' ') AS FIELD4,
NVL(LSR.ACT_POINT03, ' ') AS FIELD5,
NVL(LSR.ACT_POINT04, ' ') AS FIELD6,
NVL(LSR.ACT_POINT05, ' ') AS FIELD7,
NVL(LSR.ACT_POINT06, ' ') AS FIELD8,
NVL(LSR.ACT_SUMPOINT01, ' ') AS FIELD23,
NVL(LSR.ACT_SUMPOINT02, ' ') AS FIELD24,
NVL(LSR.ACT_SUMPOINT03, ' ') AS FIELD25,
NVL(LSR.ACT_SUMPOINT04, ' ') AS FIELD26,
NVL(LSR.ACT_SUMPOINT05, ' ') AS FIELD27,
NVL(LSR.ACT_SUMPOINT06, ' ') AS FIELD28,
LSR.SUMPOINT AS FIELD43,
NVL((SELECT TO_CHAR(LTU.TEST_POINT) TEST_POINT
FROM LCMS_TEST_USER LTU,
LCMS_TEST_TESTINFO LTI,
LCMS_TERMCOURSE_TASK LTT
WHERE LTU.ISDELETED = 'N'
AND LTI.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTI.ENTITY_ID = LTT.TASK_ID
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTI.TEST_ID = LTU.TEST_ID
AND LTU.USER_ID = LSR.USER_ID
AND LTT.ORDER_NO = '1'),
' ') TASK1,
NVL((SELECT TO_CHAR(LTU.TEST_POINT) TEST_POINT
FROM LCMS_TEST_USER LTU,
LCMS_TEST_TESTINFO LTI,
LCMS_TERMCOURSE_TASK LTT
WHERE LTU.ISDELETED = 'N'
AND LTI.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTI.ENTITY_ID = LTT.TASK_ID
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTI.TEST_ID = LTU.TEST_ID
AND LTU.USER_ID = LSR.USER_ID
AND LTT.ORDER_NO = '2'),
' ') TASK2,
NVL((SELECT TO_CHAR(LTU.TEST_POINT) TEST_POINT
FROM LCMS_TEST_USER LTU,
LCMS_TEST_TESTINFO LTI,
LCMS_TERMCOURSE_TASK LTT
WHERE LTU.ISDELETED = 'N'
AND LTI.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTI.ENTITY_ID = LTT.TASK_ID
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTI.TEST_ID = LTU.TEST_ID
AND LTU.USER_ID = LSR.USER_ID
AND LTT.ORDER_NO = '3'),
' ') TASK3,
NVL((SELECT TO_CHAR(LTU.TEST_POINT) TEST_POINT
FROM LCMS_TEST_USER LTU,
LCMS_TEST_TESTINFO LTI,
LCMS_TERMCOURSE_TASK LTT
WHERE LTU.ISDELETED = 'N'
AND LTI.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTI.ENTITY_ID = LTT.TASK_ID
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTI.TEST_ID = LTU.TEST_ID
AND LTU.USER_ID = LSR.USER_ID
AND LTT.ORDER_NO = '4'),
' ') TASK4,
NVL((SELECT TO_CHAR(LTU.TEST_POINT) TEST_POINT
FROM LCMS_TEST_USER LTU,
LCMS_TEST_TESTINFO LTI,
LCMS_TERMCOURSE_TASK LTT
WHERE LTU.ISDELETED = 'N'
AND LTI.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTI.ENTITY_ID = LTT.TASK_ID
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTI.TEST_ID = LTU.TEST_ID
AND LTU.USER_ID = LSR.USER_ID
AND LTT.ORDER_NO = '5'),
' ') TASK5,
(SELECT COUNT(LFF.FORUM_REPLY_ID)
FROM LCMS_FORUM_REPLY LFF
WHERE LFF.ISDELETED = 'N'
AND LFF.USER_ID = LUC.STUD_ID
AND LFF.REMARK LIKE '%distillate%'
AND LFF.FORUM_ID IN (SELECT LTA.ACT_ID
FROM LCMS_TERMCOURSE_ACT LTA,
LCMS_TERMCOURSE_TASK LTT
WHERE LTA.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND LTA.TASK_ID = LTT.TASK_ID
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c')) ELITESUMFOURM,
(SELECT COUNT(LFF.FORUM_REPLY_ID)
FROM LCMS_FORUM_REPLY LFF
WHERE LFF.ISDELETED = 'N'
AND LFF.USER_ID = LUC.STUD_ID
AND LFF.FORUM_ID IN (SELECT LTA.ACT_ID
FROM LCMS_TERMCOURSE_ACT LTA,
LCMS_TERMCOURSE_TASK LTT
WHERE LTA.TASK_ID = LTT.TASK_ID
AND LTA.ISDELETED = 'N'
AND LTT.ISDELETED = 'N'
AND (LTA.CHAPTER_ID <> ''
OR LTA.CHAPTER_ID IS NOT NULL)
AND LTT.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LTT.CLASS_ID = '6d71f4547f00000122d555b2b063d27c')) OPTIONALSUMFOURM
FROM LCMS_STUD_RESULTS LSR,
LCMS_USER_STUD STU,
LCMS_USER_CHOOSE LUC
WHERE STU.ISDELETED = 'N'
--AND LUC.ISDELETED = 'N'
AND STU.STUD_ID = LUC.STUD_ID
AND LUC.STUD_ID = LSR.USER_ID
AND LUC.TERMCOURSE_ID = LSR.TERMCOURSE_ID
AND LUC.CLASS_ID = LSR.CLASS_ID
AND LSR.TERMCOURSE_ID = '4a592995ac1086a52f3c2f3c964bf835'
AND LSR.CLASS_ID = '6d71f4547f00000122d555b2b063d27c'
ORDER BY GROUP_NAME, SUMPOINT;
|
|