I have a table of hits for various users:
HITS:
id | userid
1 | 1
2 | 1
3 | 2
4 | 1
5 | 2
6 | 2
I want the fastest possible way to get a list of these items ranked by ID. So this:
HITS RANKED:
id | userid | ranks
1 | 1 | 1
2 | 1 | 2
3 | 2 | 1
4 | 1 | 3
5 | 2 | 2
6 | 2 | 3
I want to avoid joining two tables to each other, as this takes forever when the tables get big. Any other suggestions?