在下表中,我希望Supp_ID对于Product和RouteCode的相同组合具有相同的速率
所以,我应该得到除第一行之外的所有行。
Supp_ID Product RouteCode Rate
25sdf-1 PROD1 2-00 0.0436
302qq-6 PROD1 1-00 0.0815
30wqa-6 PROD1 1-00 0.0815
20xdf-1 PROD1 3-00 0.0936
28xdf-1 PROD1 3-00 0.0936
答案 0 :(得分:1)
您可以使用Window功能来帮助:
SELECT *
FROM (SELECT supp_id, product, routecode, rate,
count(*) OVER (PARTITION BY rate, Supp_Id, Product) as count_of_shared_rate
FROM table) t1
WHERE count_of_shared_rate > 1