Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Ranking In Mysql


BlackEyes
 Share

Recommended Posts

I have a table that looks like:

kXBX4XK.png

 

The problem is after using this query:

SET @r=0;
UPDATE times SET points:= @r:= (@r+1) ORDER BY MapID, Type, Style, Time DESC;

 

It doesn't reset r to 0 once MapID OR Type OR Style change

 

If I were to order it by MapID, Type, Style, and Time right now, it would look like this:

CnXrgP3.png

 

If r were to reset once MapID, Type, or Style change, points would look like 1,1,1,1,1,1,1. Sorry, I'm the only player who tested my timer at this stage so of course I would be the only one getting ranked, giving me 1 point in each record

 

If someone else were to get a record on MapID 1, Type 0, and Style 0 and they also got a better time than me, they would get 2 points and I would get 1. It is basically ranking in a descending order in different categories.

 

EDIT: I think I have to make sure the entire query that ranks everything is in one statement. I don't believe sourcepawn has support for multiple statements in one query.

Edited by BlackEyes
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share