Problem on listing query results
I have the table below:
+-----+-------+-----------+
| ID | USER | DATA |
+-----+-------+-----------+
| 1 | 1 | 2004-01-01 |
| 2 | 1 | 2004-02-01 |
| 3 | 2 | 2004-01-01 |
| 4 | 2 | 2004-03-01 |
| 5 | 1 | 2004-05-01 |
| 6 | 3 | 2004-09-01 |
| 7 | 3 | 2004-07-01 |
| 8 | 2 | 2004-02-01 |
+-----+-------+-----------+
where the primary key is ID and I need to select from the table ONLY ONE ID for USER, and this ID must be that WITH THE HIGHEST DATE, so the final result will be ordered BY DATE DESC. The result will be the same as below:
+-----+-------+-----------+
| ID | USER | DATA |
+-----+-------+-----------+
| 6 | 3 | 2004-09-01 |
| 5 | 1 | 2004-05-01 |
| 4 | 2 | 2004-03-01 |
+-----+-------+-----------+
Can anyone solve this?
Subject
Written By
Posted
Problem on listing query results
August 01, 2004 02:13PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.