I need to make a query in a table that compares the value of a field in the table with the value of the same field in the table in another record.
If the table is something like this:
| Contrato | Oper | Importe |
+------------+-------+---------+
| 00002158 | B234 | -10.00 |
+------------+-------+---------+
| 00002158 | B217 | 120.00 |
+------------+-------+---------+
| 00002158 | B173 | 100.00 |
+------------+-------+---------+
You would need to find those records where, for the same contract, the amount of the operation B217
is greater than the amount of the operation B173
.
You should return the last two records.
Thanks and best regards