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 'OR ( SC_categories.categoryID= SC_categoryes_category.CategoryIDs AND SC_categor' at line 1
SELECT SC_categories.categoryID FROM SC_categories LEFT JOIN SC_categoryes_category on (SC_categories.categoryID=SC_categoryes_category.CategoryIDs) WHERE (SC_categories.parent= OR ( SC_categories.categoryID= SC_categoryes_category.CategoryIDs AND SC_categoryes_category.CategoryID=) ) and no_visible =0