I have a table that contains dates and payment amounts for users (several hundred per user). I am trying to select the record with the newest date for each user. Individual queries per user is taking for ever, so I tried to get the whole dataset this way:
select usr,dt from test a
where dt =
(select max(dt) from test b where a.usr=b.usr)
But this also seems to be taking far to long (I have about 250,000 users). Anybody have any thoughts on a better algorithm for getting this data? I don't have the ability to change the table easily (3rd party), so adding an index would be difficult.