question

Rohit_3 avatar image
Rohit_3 asked

Need to fetch all the records of the student with respect to teacher id . I'm finding syntax error in this code please help me. MYsql phpadmin mariadb version.

DELIMITER $ CREATE PROCEDURE `sp_getstudentdetails_testQ`(IN `teacher_id` INT(15), IN `student_name` VARCHAR(30), IN `student_grades` VARCHAR(5), IN `student_status` VARCHAR(15), IN `Engagement_range` VARCHAR(30)) BEGIN select u.name as studentname,u.id as studentid,u.profile as studentprofile,u.createdby as createdby,u.createdon as createdon, u.updatedby as updatedby,u.updatedon as updatedon,u.flag_status as flagstatus,u.form_status as formstatus,s.schoolname as schoolname, s.id as schoolid,schm.idnteacher as teacherid,ud.grade from user as u left join student_class_hour_map as schm on u.id = schm.idnstudent left join school_student_rel as ssr on ssr.student_id = schm.idnstudent left join school as s on s.id = ssr.school_id LEFT join user_details as ud on u.id = ud.user_id where profile = 5 and schm.idnteacher = teacher_id and u.name like CONCAT('%',student_name,'%') AND IF(student_grades != '',FIND_IN_SET(ud.grade,student_grades),1); IF student_status != '' THEN IF student_status ='2' THEN (u.status=2 OR u.form_status<=2); ELSE FIND_IN_SET(u.flagstatus,student_status); END IF; END IF; END IF; End $$ DELIMITER;

stored-proceduresmysqlerrorsyntax
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.