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