Возникла ошибка базы данных

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 'or cg.pid=) and c.is_block=0 and c.is_show=1' at line 7

select min(price) as min_price, max(price) as max_price from catalog c inner join catalog_group cg on cg.id=c.pid where (c.pid= or cg.pid=) and c.is_block=0 and c.is_show=1

Filename: /home/t/tetra/newbowerlife/public_html/core/MY_Model.php

Line Number: 335