I have a table article_pair with columns rule_id, driver_article, driver_article_uom, pair_article and pair_article_uom. The driver_article and pair_article, driver_article_uom and pair_article_uom should not be the same in the data which we select. I could do this by using the below query, but is there is any alternate approach?
SELECT * FROM article_pair
MINUS
SELECT * FROM article_pair
where driver_article=pair_article
AND driver_article_uom=pair_article_uom
In this example, artilce_pair is a table. But in my scenario, it is a sub query.
You can get it with Where clause using either AND or OR operator depending on do both pairs need to differ or just one of them: