Files
2026-10-19 15:22:52 -07:00

10 lines
394 B
SQL

SELECT userid,concat('',email,''),u.type,sum(ua.transaction_amount),count(distinct st.record_num),u.record_num
FROM users AS u
LEFT JOIN user_account as ua ON u.record_num = ua.user_num
LEFT JOIN people as st on u.record_num = st.user_num and st.school_num = 1 and st.people_type = 'Student'
WHERE u.school_num = 1
and u.type = 'Parent'
and u.record_num = 262
GROUP BY 1,2,3,6
ORDER BY userid;