If you run the first query, you will get the result as '65195' If you run the second query, you will get the same result. What I need to do is, if 65195 exists in both the tables (productblocking and productallowlist), the query should return no result. If it just exists in productblocking table, it should return the result. How to do this?
SELECT p.productid
FROM product p
JOIN productblocking pb ON p.productid=pb.productid
WHERE customerlevelid='5' and p.productid = '65195'
SELECT p.productid
FROM product p
JOIN productallowlist pa ON p.productid=pa.productid
WHERE customerlevelid='5' and p.productid = '65195' and customerid='62030'