SQLSTATE[42000]: Syntax error or access violation: 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 'AND st.f_flag = 1 ORDER BY st.rr_cd, st.line_sort' at line 1. SQL:SELECT DISTINCT cd.name AS rr_name, st.line_cd, st.line_name FROM tbllinestation AS st LEFT JOIN tblcode AS cd ON cd.classCode = 800 AND cd.code = st.rr_cd WHERE st.prefCode = AND st.f_flag = 1 ORDER BY st.rr_cd, st.line_sort |