Jump to content
  • 0

Support on SQL.


Lil Troll

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Hi guys another question regarding SQL, can anyone help me or teach me how to choose top 3 from a specific column in sql?

And later on claim their price by getting it to specific  NPC?

 

Am here right now:

query_sql "select pool from `system_system` order by pool DESC LIMIT 3",.@placer;

Now the next part is? IDK what to do. XD

 

Also I would like to know how to delete a specific values from a table in sql:

Like this: I would only like to delete the value not the table.

query_sql(DELETE FROM system_system WHERE pool

or this? I cant make both work. :(

query_sql "REPLACE INTO `system_system` (`pool`) VALUES ('0')
Edited by Lil Troll
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

1.

prontera,180,150,4%TAB%script%TAB%npc_name%TAB%123,{
set .@a,getcharid(0);
if( .@placer[0] == .@a || .@placer[1] == .@a || .@placer[2] == .@a )
    {getitem .reward,1; query_sql("DELETE FROM `system_system` WHERE `pool`='"+ .@a +"'"); end;}
dispbottom "Only the Top 3 can receive a reward.";
end;

OnClock0000: //Once a day do this.
query_sql("SELECT `pool` from `system_system` ORDER BY `pool` DESC LIMIT 3",.@placer);
end;
}

Your problem, was you weren't specifying exactly where to delete.

Edited by Lionhardt
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   5
  • Joined:  09/03/13
  • Last Seen:  

I'm a bit rusty, but let me try ^^

 

query_sql "SELECT `pool` FROM `system_system` ORDER BY `pool` DESC LIMIT 3", @pool;

@pool[0]; // -> value 1
@pool[1]; // -> value 2
@pool[2]; // -> value 3
query_sql "DELETE FROM `system_system` WHERE `pool`='" + @value + "'";
query_sql "UPDATE `system_system` SET `pool` =  '" + @newValue + "' WHERE `id` = '1'";

 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Wow thanks so much @sir Simon and @sir Lionhardt! I can finally finish my new idea on World of fishing! Thanks! :)

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
Answer this question...

×   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.

×
×
  • Create New...