I am struggling with a problem that i'm trying to solve on a ORACLE DB 19.0.0.0.0
I have a TABLE like this:
ID | CODE | AMOUNT | VAR1 | VAR2
+-------------------------------
10 | 255 |192.50 |CLOSED | 1
10 | 342 |192.50 |OPEN | 7
10 | 921 |255.00 |RUNNING| 2
10 | 222 |255.00 |CLOSED | 10
13 | 101 |10.00 |RUNNING| 3
13 | 122 |19.25 |RUNNING| 7
71 | 804 |21.25 |OPEN | 9
71 | 744 |21.25 |RUNNING| 2
13 | 100 |950.00 |OPEN | 10
90 | 126 |17.80 |RUNNING| 0
90 | 137 |9.00 |RUNNING| 0
And i need to select rows that have the same ID and same AMOUNT. they can form pairs, trios or more, In other words, i need to discard IDs and AMOUNTs that are unique. The others columns can have any value
I expect to return:
ID | CODE | AMOUNT | VAR1 | VAR2
+-------------------------------
10 | 255 |192.50 |CLOSED | 1
10 | 342 |192.50 |OPEN | 7
10 | 921 |255.00 |RUNNING| 2
10 | 222 |255.00 |CLOSED | 10
71 | 804 |21.25 |OPEN | 9
71 | 744 |21.25 |RUNNING| 2
I already tried doing a query that return only the unique ID + AMOUNT rows, creating an "UNIQUE KEYS TABLE", and then a JOIN or a WHERE in the TABLE, but in my case it is not efficient enough
What is the best and efficient way to solve this ?