error:1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where c.del_flag=0 and ( c.hidden_flag=0 or exists (select * from M_COURSE as c_' at line 1
sql=select * from M_COURSE as c inner join M_SPOT_COURSE as sc on c.course_no = sc.course_no and sc.spot_no= where c.del_flag=0 and ( c.hidden_flag=0 or exists (select * from M_COURSE as c_sub where c_sub.course_no_jikantai_parent = c.course_no and c_sub.del_flag=0 and c_sub.hidden_flag=0)) order by c.course_dispno