0

i need help on how to display this on html or php. i have this dynamic pivot table code.

    SET @sql_dynamic:= (SELECT GROUP_CONCAT(DISTINCT CONCAT('if(sum(if(attendance_date = "',
                    date_format(attendance_date, '%Y-%m-%d'),
                    '",1,0))=0,0,attendance_status) AS `',
                    date_format(attendance_date, '%Y-%m-%d'),'`'
                    )
                ) from attendance
                  WHERE subject_id=1 AND attendance_month = "January"
              );

    SET @sql = CONCAT('SELECT studentidnumber, student_fullname, subject_id, attendance_month, ', 
    @sql_dynamic,  ' 
FROM attendance
     WHERE subject_id=1 AND attendance_month = "January"
GROUP BY studentidnumber');

    PREPARE stmt FROM @sql;
    EXECUTE stmt;

and i cant seem to work this on Phpmyadmin i dont know why.

error

but, it's working with dbForgeMySQLStudio

worksss

pls can someone assist me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.