I am new to this LMS development, so I am trying to figure out a few custom blocks. My question again is related to scorm interactions. I have added this sql query
SELECT scc.userid AS User, sct.name AS Name, scc.scoid AS SCORM_ID, sct.module AS Module, scc.value AS Sale_amount, sct.value AS Loan_amount
FROM
(SELECT u.id AS userid, st.scoid AS scoid, st.value AS value
FROM prefix_course AS c
LEFT JOIN prefix_scorm AS sc ON sc.course=c.id
LEFT JOIN prefix_scorm_scoes_track AS st ON st.scormid=sc.id
LEFT JOIN prefix_user AS u ON u.id=st.userid
WHERE st.element='cmi.interactions_0.student_response') AS scc
LEFT JOIN
(SELECT c.fullname Course, sc.name AS module, st.scoid AS scoid, u.id AS userid, u.firstname name, st.attempt as Attempt, st.value AS value
FROM prefix_course AS c
LEFT JOIN prefix_scorm AS sc ON sc.course=c.id
LEFT JOIN prefix_scorm_scoes_track AS st ON st.scormid=sc.id
LEFT JOIN prefix_user AS u ON u.id=st.userid
WHERE st.element='cmi.interactions_1.student_response') AS sct
ON sct.scoid=scc.scoid
AND sct.userid=scc.userid
ORDER BY scc.userid
to generate reports on loan amounts and sale amounts. Now I want to display it in the form of custom block showing only the total loan amount and sale amount by the user that they have made. This is a little tricky. For example: here in this screenshot, for the admin user, the total loan amount should be 17800 and sale amount: 116000
Is this possible in any way by using SELECT sum(value) WHERE element='cmi.interactions_0.student_response' sale amount= sum of student response