I basically need this with some adjustments, I just can't seem to figure it out how to do it. I need to sum the rows of two tables, for example:
SELECT
student.StudentID,
student.`Name`,
COUNT(attendance.AttendanceID) AS Total
FROM
student
LEFT JOIN attendance ON student.StudentID = attendance.StudentID
GROUP BY student.StudentID,student.`Name\`;
This would return
+-----------+-------------------+-------+
| StudentID | Name | Total |
+-----------+-------------------+-------+
| k1052280 | Ali Shaikh | 2 |
| k1052287 | McKenzie Roth | 2 |
| k1052288 | Dacey Sullivan | 1 |
| k1052294 | Zelda Cantu | 0 |
| k1052295 | Kimberly Melton | 3 |
| k1052296 | Tatianna Cantrell | 0 |
| k1052297 | Morgan Thornton | 0 |
| k1052298 | Allistair Barlow | 0 |
| k1052299 | Troy Fulton | 0 |
+-----------+-------------------+-------+
Total being the rows for the attendance table/student. I need to add in another table, for example meetings, i need a SUM of the two, so the total should be the sum of meetings + attendances for each student.
(StudentID, COUNT(AttendanceID))in subquery. Do the same withmeetings. Join these 2 subqueries tostudenttable and obtain/calculate the result you need.