You can use prepared statements -
SET @tables = NULL; SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name,'`') INTO @tables FROM information_schema.tables WHERE table_schema = 'myDatabase' AND table_name LIKE BINARY 'del%'; SET @tables = CONCAT('DROP TABLE ', @tables); PREPARE stmt1 FROM @tables; EXECUTE stmt1; DEALLOCATE PREPARE stmt1;
It will generate and execute an operator like this -
DROP TABLE myDatabase.del1, myDatabase.del2, myDatabase.del3;
Devart Jun 15 2018-12-12T00: 00Z
source share