Lil Troll Posted September 4, 2013 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
GmOcean Posted September 4, 2013 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
Sim0n Posted September 4, 2013 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
Lil Troll Posted September 4, 2013 Author 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
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 Troll3 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.