This question already has an answer here:
I have two tables Student_Attendance and Students.
I am using this query:
SELECT sa.Student_Id, sa.Attendance_Date, CASE WHEN sa.Attendance_Status as Status FROM student_attendance sa INNER JOIN courses c ON c.Course_Id = sa.Course_Id INNER JOIN students es ON es.Student_Id = sa.Student_Id WHERE sa.Course_Id = 1 ORDER BY sa.Attendance_Date DESC;
I am getting this result from above query:
But I want something like below:
In the student_attendance table there are more than 50 rows.
How 7 attendance_date rows should be converted into 7 columns as I have given below?
Can someone help me please?