Raised This Month: $ Target: $400
 0% 

SQL Top


Post New Thread Reply   
 
Thread Tools Display Modes
maza51
Senior Member
Join Date: Mar 2010
Old 02-04-2011 , 18:16   Re: SQL Top
Reply With Quote #11

Thank you.

But this only shows the top. And if I want to learn rank?

I've been using for the top 10
Code:
Format(query, sizeof(query), "SELECT * FROM 'Rank' WHERE points ORDER BY points DESC LIMIT 0, 10");
For rank
Code:
Format(query, sizeof(query), "SELECT * FROM 'Rank' WHERE steamId ='%s'", steamId);
But I can only learn Points...

It is necessary to write:
You are a 35 place out of 300.. in statistics.

Last edited by maza51; 02-04-2011 at 18:30.
maza51 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 02-05-2011 , 03:52   Re: SQL Top
Reply With Quote #12

You will have to sort.
__________________
FaTony is offline
maza51
Senior Member
Join Date: Mar 2010
Old 02-05-2011 , 04:23   Re: SQL Top
Reply With Quote #13

Quote:
Originally Posted by FaTony View Post
You will have to sort.
I do not understand
maza51 is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 02-05-2011 , 08:05   Re: SQL Top
Reply With Quote #14

example
Code:
SELECT NAME,steamId FROM `Player` ORDER BY POINTS DESC LIMIT 0,10
"Points" is the field from the database table "Player" this fetches the top 10 including 0 players from that field who has the most points...

this code gets fetches the players points from there steam id to.
__________________
Master(d)



Master53 is offline
maza51
Senior Member
Join Date: Mar 2010
Old 02-05-2011 , 08:17   Re: SQL Top
Reply With Quote #15

It works for me fine. How do I know in what position I'm in the statistics, if I do not have the top 10??
maza51 is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 02-05-2011 , 08:32   Re: SQL Top
Reply With Quote #16

what are you using to display the top 10?
__________________
Master(d)



Master53 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 02-05-2011 , 08:36   Re: SQL Top
Reply With Quote #17

Query all entries in DB and find your one, storing it's index.
__________________
FaTony is offline
maza51
Senior Member
Join Date: Mar 2010
Old 02-05-2011 , 08:37   Re: SQL Top
Reply With Quote #18

Quote:
Originally Posted by Master53 View Post
what are you using to display the top 10?
SELECT * FROM 'Rank' WHERE points ORDER BY points DESC LIMIT 0, 10
maza51 is offline
maza51
Senior Member
Join Date: Mar 2010
Old 02-05-2011 , 08:39   Re: SQL Top
Reply With Quote #19

Quote:
Originally Posted by FaTony View Post
Query all entries in DB and find your one, storing it's index.
http://forums.alliedmods.net/showpos...1&postcount=11
!!!!!
maza51 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 02-05-2011 , 08:54   Re: SQL Top
Reply With Quote #20

Select without limit.
__________________
FaTony is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode