我正在尝试将礼物总数除以总天数。Count 语句单独工作,但是当我尝试将这两个计数相除时,报告不会运行。有任何想法吗?
((SELECT COUNT(*)
FROM ATTENDANCE
LEFT OUTER JOIN ATTENDANCE_CODE
ON ATTENDANCE_CODE.ID = ATTENDANCE.ATTENDANCE_CODEID
LEFT OUTER JOIN PERIOD
ON PERIOD.ID = ATTENDANCE.PERIODID
WHERE ATTENDANCE.STUDENTID = STUDENTS.ID
AND ATTENDANCE.ATT_DATE BETWEEN '%param1%' AND '%param2%'
AND PERIOD.PERIOD_NUMBER BETWEEN '1' AND '8'
AND ATTENDANCE.ATT_MODE_CODE = 'ATT_ModeMeeting'
AND ATTENDANCE.SCHOOLID = STUDENTS.SCHOOLID
AND ATTENDANCE_CODE.ATT_CODE = 'LZP'
)/
(SELECT COUNT(*)
FROM ATTENDANCE
LEFT OUTER JOIN ATTENDANCE_CODE
ON ATTENDANCE_CODE.ID = ATTENDANCE.ATTENDANCE_CODEID
LEFT OUTER JOIN PERIOD
ON PERIOD.ID = ATTENDANCE.PERIODID
WHERE ATTENDANCE.STUDENTID = STUDENTS.ID
AND ATTENDANCE.ATT_DATE BETWEEN '%param1%' AND '%param2%'
AND PERIOD.PERIOD_NUMBER BETWEEN '1' AND '8'
AND ATTENDANCE.ATT_MODE_CODE = 'ATT_ModeMeeting'
AND ATTENDANCE.SCHOOLID = STUDENTS.SCHOOLID
AND (ATTENDANCE_CODE.ATT_CODE = 'A' or ATTENDANCE_CODE.ATT_CODE = 'LZA' or ATTENDANCE_CODE.ATT_CODE =
'LZP')
))