Either use single quotes, like
q = "select tbuc.csId, tbuc.uId, tbuc.cId, tbui.role_type, tbuc.time as login_date"
+ ", tbuc.sessId, (case when tbui.role_type="ROLE_USER" then 1 else 0 end) "
+ "as assignment_submitted FROM tb_user_click tbuc, tb_user_info tbui WHERE "
+ "tbui.user_id = tbuc.uId and tbuc.csId = tbui.class_section_id;"
Or escape the double quotes, like
q = "select tbuc.csId, tbuc.uId, tbuc.cId, tbui.role_type, tbuc.time as login_date"
+ ", tbuc.sessId, (case when tbui.role_type = \"ROLE_USER\" then 1 else 0 end"
+ ") as assignment_submitted FROM tb_user_click tbuc, tb_user_info tbui WHERE "
+ "tbui.user_id = tbuc.uId and tbuc.csId = tbui.class_section_id;"
Or (assuming your client supports it) use a bind parameter, like
q = "select tbuc.csId, tbuc.uId, tbuc.cId, tbui.role_type, tbuc.time as login_date"
+ ", tbuc.sessId, (case when tbui.role_type = ? then 1 else 0 end) "
+ "as assignment_submitted FROM tb_user_click tbuc, tb_user_info tbui WHERE "
+ "tbui.user_id = tbuc.uId and tbuc.csId = tbui.class_section_id;"
0
solved Query SyntaxError [closed]