I’m trying to get a users position between the users friends, but I don’t have any idea of how I can do this…
I have two tables.
Table 1: friends (where all the users friends are listed)
Table 2: users (where all the users are listed)
I want the query to check the users position between his friends.
So if I, for example have ID 1 (with 100 credits) and a friend with ID 2 (with 21 credits), the query would list my position as 1.
You don’t really provide much information on your table layout, so it’s going to be impossible for me to provide a very specific example. I’m also afraid I don’t really understand your question, but I’ll give it a shot…
First, I’ll assume your users table has at least these columns:
And that the friends table has these columns:
Now, if I understand your question, you want to rank all of a user’s friends, based on how many credits they have, so: