Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I think this is a question which can be solved with a min/max function, but I can't get it done. I hope one of you guys can help me out.
I do have the following data:
| CONTACTID | ACCOUNTID | DATESCHEDULED |
|---|---|---|
| 10 | 150 | 02-05-2012 |
| 12 | 150 | 06-07-2012 |
| 15 | 150 | 05-06-2012 |
| 20 | 150 | 03-04-2012 |
| 50 | 160 | 05-02-2012 |
| 55 | 160 | 05-07-2012 |
| 65 | 160 | 16-04-2012 |
Now I would like to see the contactids per accountid which have the highest date. The result should be like this:
| CONTACTID | ACCOUNTID | DATESCHEDULED |
|---|---|---|
| 12 | 150 | 06-07-2012 |
| 55 | 160 | 05-07-2012 |
As you can see, there is no logic between the contactids and the datescheduled.
I am using Oracle SQL, but solutions in another way are also welcome.
Regards,
Henco
Thanks.