Filters: and productstatus != 0 and not exists (select * from productproductcats where productproductcats.productid=products.productid and productcatid='2') and not exists (select * from productproductcats where productproductcats.productid=products.productid and productcatid='1')