Lil Troll Posted September 4, 2013 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 276 Reputation: 24 Joined: 07/06/13 Last Seen: April 19, 2014 Share Posted September 4, 2013 (edited) 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 September 4, 2013 by Lil Troll Quote Link to comment Share on other sites More sharing options...
GmOcean Posted September 4, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted September 4, 2013 (edited) 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 September 4, 2013 by Lionhardt 1 Quote Link to comment Share on other sites More sharing options...
Sim0n Posted September 4, 2013 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 5 Reputation: 5 Joined: 09/03/13 Last Seen: June 19, 2019 Share Posted September 4, 2013 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'"; 1 Quote Link to comment Share on other sites More sharing options...
Lil Troll Posted September 4, 2013 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 276 Reputation: 24 Joined: 07/06/13 Last Seen: April 19, 2014 Author Share Posted September 4, 2013 Wow thanks so much @sir Simon and @sir Lionhardt! I can finally finish my new idea on World of fishing! Thanks! Quote Link to comment Share on other sites More sharing options...
Question
Lil Troll
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:
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.
or this? I cant make both work.
Edited by Lil TrollLink to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.