select distinct(W.worksheetName),, W.slug ,K.keystage_no, W.topic_id, W.id from ep_worksheets W inner join ep_wskeystage K on K.id = W.keyStage where W.subject='1' and W.organization_id = '1' and W.status='1' and W.topic_id='916' and W.year in (SELECT id FROM ep_wsyears where year='7') order by W.is_public desc, W.worksheetName asc
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 ' W.slug ,K.keystage_no, W.topic_id, W.id from ep_worksheets W inner join ep_wske' at line 1