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 's-shoes'' at line 1SELECT c.*, cm.SearchIndex FROM categories c LEFT JOIN categories_main cm ON (c.Main = cm.ID) WHERE c.SEO = 'boy's-shoes'