set @string$, "( `name_aegis` IN ( SELECT DISTINCT `drop1_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop2_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop3_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop4_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop5_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop6_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop7_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop8_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop9_item` FROM `mob_db_re` ) " +
"OR `name_aegis` IN ( SELECT DISTINCT `drop10_item` FROM `mob_db_re` ) )";
set @sql_query$, "SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND " + .@string$;
dispbottom "Generated SQL query: " + @sql_query$;
.@nb = query_sql(@sql_query$, .@id);
Error:
[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
[Debug]: at D:\Games\Ragnarok\01_emulator\renewal\src\map\script.cpp:17797 - SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND
[Warning]: Script command 'query_sql' returned failure.
[Debug]: Source (NPC): Card_Quest_NPC at moc_para01 (16,13)
[Debug]: Source (NPC): Card_Quest_NPC is located in: npc/custom/Card_Collector.txt
I even tried this in query tab of database
SELECT COUNT(*) FROM `mob_db_re` WHERE `drop8_item` IS NOT NULL;
it returned 859. So meaning it has value.
I also tried this
set @query$, "SELECT `mob_db_re`.`drop8_item` FROM `mob_db_re`";
dispbottom "Generated SQL query: " + .@query$;
.@nb = query_sql(.@query$, .@id);
dispbottom "Number of rows returned: " + .@nb;
Question
Louis T Steinhil
This is my code but i always get an error:
set @string$, "( `name_aegis` IN ( SELECT DISTINCT `drop1_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop2_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop3_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop4_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop5_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop6_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop7_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop8_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop9_item` FROM `mob_db_re` ) " + "OR `name_aegis` IN ( SELECT DISTINCT `drop10_item` FROM `mob_db_re` ) )"; set @sql_query$, "SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND " + .@string$; dispbottom "Generated SQL query: " + @sql_query$; .@nb = query_sql(@sql_query$, .@id);
Error:
[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 [Debug]: at D:\Games\Ragnarok\01_emulator\renewal\src\map\script.cpp:17797 - SELECT `item_db_re`.`id` FROM `item_db_re` WHERE `type` = 'Card' AND [Warning]: Script command 'query_sql' returned failure. [Debug]: Source (NPC): Card_Quest_NPC at moc_para01 (16,13) [Debug]: Source (NPC): Card_Quest_NPC is located in: npc/custom/Card_Collector.txt
I even tried this in query tab of database
SELECT COUNT(*) FROM `mob_db_re` WHERE `drop8_item` IS NOT NULL;
it returned 859. So meaning it has value.
I also tried this
set @query$, "SELECT `mob_db_re`.`drop8_item` FROM `mob_db_re`"; dispbottom "Generated SQL query: " + .@query$; .@nb = query_sql(.@query$, .@id); dispbottom "Number of rows returned: " + .@nb;
it didn't return anything.
Link to comment
Share on other sites
5 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.