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 'ORDER BY SortOrder' at line 1
SELECT PkCategoryId,CategoryName,ParentCategoryId,CategoryDepth,Status,SortOrder FROM product_categories WHERE 1 AND ParentCategoryId= ORDER BY SortOrder