SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA` . `SCHEMATA` , ( SELECT `DB_first_level` FROM ( SELECT DISTINCTROW `SUBSTRING_INDEX` ( SCHEMA_NAME , ?, ... ) `DB_first_level` FROM `INFORMATION_SCHEMA` . `SCHEMATA` WHERE TRUE ) `t` ORDER BY `DB_first_level` ASC LIMIT ?, ... ) `t2` WHERE ? = `LOCATE` ( `CONCAT` ( `DB_first_level` , ? ) , `CONCAT` ( SCHEMA_NAME , ? ) ) ORDER BY SCHEMA_NAME ASC 