Fatal error: Uncaught exception 'PDOException' with message '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 'AND ( select COUNT(*) from rel_categorias_produtos where categorias_id = id) > 0' at line 1' in /var/www/html/WEB-INF/classes/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /var/www/html/WEB-INF/classes/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /var/www/html/WEB-INF/classes/Zend/Db/Statement.php(302): Zend_Db_Statement_Pdo->_execute(Array) #2 /var/www/html/WEB-INF/classes/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->execute(Array) #3 /var/www/html/WEB-INF/classes/Zend/Db/Adapter/Pdo/Abstract.php(239): Zend_Db_Adapter_Abstract->query('SELECT * FROM `...', Array) #4 /var/www/html/classes/app/sistema/models/NewCategoriasSistema.php(123): Zend_Db_Adapter_Pdo_Abstract->query('SELECT * FROM `...') #5 /var/www/html/classes/app/site/controllers/Categori in /var/www/html/WEB-INF/classes/Zend/Db/Statement/Pdo.php on line 234