Raised This Month: $ Target: $400
 0% 

Trie mysql place selecting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 10-17-2011 , 14:25   Trie mysql place selecting
Reply With Quote #1

Hey, so I've a mysql /rank with Trie, but now I would like to create a /top also, so I need first ... fifth player Name and Skill from mysql table's, the Name is in X table, Skill is in Y table, but both tables has same player IP's. How could I select them ? Here is my code:

Code:
new Entries; new Trie:Positions; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         Positions = TrieCreate();     register_clcmd("say /rank", "CmdRank") } public CmdRank(id) {     new szSteam[33];     get_user_authid(id, szSteam, 32)     client_print(id, print_chat, "you are %d of %d", GetPosition(szSteam), Entries) } public UpdateRank() {     SQL_ThreadQuery(g_SqlTuple, "OnUpdateRank", "SELECT pSteam FROM pStats ORDER BY pSkill DESC"); } public OnUpdateRank(failState, Handle:query, error[], errorCode) {     if (errorCode)         set_fail_state(error);       Entries = 0;     new szSteam[33];       while (SQL_MoreResults(query))     {         SQL_ReadResult(query, 0, szSteam, charsmax(szSteam));         TrieSetCell(Positions, szSteam, Entries++);                 SQL_NextRow(query);     } }   GetPosition(const szSteam[]) {     new pos;       TrieGetCell(Positions, szSteam, pos);       return pos + 1; }
reinert is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-17-2011 , 14:55   Re: Trie mysql place selecting
Reply With Quote #2

SELECT name, skill FROM X JOIN Y ON X.ip=Y.ip WHERE X.ip='%s';
__________________
Impossible is Nothing
Sylwester is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 10-17-2011 , 15:39   Re: Trie mysql place selecting
Reply With Quote #3

Ok thank you for SQL Syntax, so it can be done with JOIN, is it necessary to use INNER or OUTER ?
reinert is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-17-2011 , 16:08   Re: Trie mysql place selecting
Reply With Quote #4

If there is player ip in each table then you don't need to change it.
__________________
Impossible is Nothing
Sylwester 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 06:00.


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