I want to count top N book buyers. I have data like this,
- For book 1, user 1, user 2 and user 3 purchased;
- For book 2, user 2 and user 3 purchased;
- For book 3, user 3 and user 4 purchased.
If I want to select top 3 book buyers, they are user 3, user 2 and user 1 (or user 4).
Any thoughts how to index book purchase information and select top N buyers, is highly appreciated.
BTW, I just need to count for top N, no need for sorting inside top N.
thanks in advance,