I have a SELECT, that returns me something similar to this result (I've simplified it, because the original SELECT is rather complex):
| UserFK | aDate | aValue |
---------------------------------------------
| 1000 | 03.12.2012 10:00 | 123 |
| 1000 | 03.12.2012 11:00 | 456 | <--
| 1001 | 03.12.2012 09:00 | 111 | <--
| 1002 | 03.12.2012 09:00 | 222 |
| 1002 | 03.12.2012 10:00 | 333 | <--
| 1003 | 03.12.2012 09:00 | 123 |
| 1003 | 02.12.2012 09:00 | 123 |
| 1003 | 03.12.2012 10:00 | 455 | <--
| 1004 | 03.12.2012 11:00 | 123 | <--
Now I don't want any duplicate UserFK, I only want the last (by aDate) UserFK and it's value. I've marked the ones that I actually want.
Is there a simple way to do it?