An Error Was Encountered

Error Number: 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 '' at line 1

select c.id as sub_id, c.type as sub_cat, p.* from products p join category c on c.id=p.category_id where p.id=