Hope you can help me with this one. Supose I have a table which looks like this (sorry, but my reputation isn't high enough to post images):
[ACCOUNT] [PROGRAM] [DATE] [AMOUNT]
[500] [P1] [10/10/2014] [4.2]
[500] [P2] [09/08/2010] [5.1]
[501] [P1] [08/02/2010] [2.3]
[501] [P3] [10/11/2014] [9.2]
Now, grouping by account, I want to sum the amounts, while keeping the program belonging to the latest date. I want to achieve this, in Oracle SQL:
[ACCOUNT] [PROGRAM] [AMOUNT]
[500] [P1] [9.3]
[501] [P3] [11.5]
Could anybody lend me a hand, please? Thank you very much!