Log in

View Full Version : Show All Player Useable Spells By Level Query


Uleat
11-06-2015, 10:48 PM
This arose from an exercise in futility - if you find it useful...

SET @sl = '1'; -- spell level
SET @qstr = CONCAT('SELECT \'', @sl, '\' level, `id`, `name`, `targettype` target_type, `SpellAffectIndex` spell_effect_index FROM `spells_new` WHERE \'', @sl, '\' IN (', (SELECT GROUP_CONCAT(CONCAT('`',`COLUMN_NAME`,'`') ORDER BY `ORDINAL_POSITION` SEPARATOR ',') FROM `information_schema`.`COLUMNS` WHERE (`table_schema` = DATABASE() AND `TABLE_NAME` = 'spells_new' AND `COLUMN_NAME` LIKE 'classes%')), ') ORDER BY `name`');
PREPARE stmt FROM @qstr;
EXECUTE stmt;

Shin Noir
01-25-2016, 03:26 AM
I just used this, btw, it's useful and handy.