Quote:
|
Originally Posted by lonrot
... all pairs of salesman whose sales were 5% of each other on every product
|
Try a self-join with these two conditions (equality on product, and "sales1 > 1.05*sales2") as the join condition.
You'll probably also need some kind of "group by" (& having count(*) = 3) if by "every product" you really mean all 3 products.
Try building up the query logic step by step, by using CTEs.