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 works.G_ID = genre.GID AND works.T_ID = tech.TID AND tech.TC_ID = tch.TCID' at line 1