I'm trying to get MySQL tables by name starting with prefix "someprefix_", but I get wrong (?) results.
I tried to execute SHOW COLUMNS LIKE 'someprefix_%' but problem is, that I have also tables with prefix "someprefix2_" and those tables are also being returned in the result.
Is there a way to exclude tables with a similar prefix from the result?
To list all tables with some prefix, "any number of symbols" wildcard (%), should be used.
_ is also a wildcard, representing any single symbol, and therefore it should be escaped.
Therefore, given your prefix is someprefix_, then
SHOW TABLES LIKE 'someprefix\_%'
would work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With