Reputation: 183
Using
SHOW TABLES in mydatabase
gives me a list of all included tables. Like
+----------+-----------+----------+
| database | tableName | comment |
+----------+------------+---------+
| db1 | table1 | null |
| db1 | table2 | null |
| db1 | table_trkw | null | |
I just want to get the tables that include a specific string, say "trkw"
When using
SHOW TABLES in db1 WHERE tableName IN ('%trkw%');
Or
SHOW TABLES in db1 WHERE tableName LIKE '%trkw%';
I keep getting the same error:
Error in SQL statement: ParseException: mismatched input WHERE' expecting <EOF>
I just don't get what's wrong with the WHERE condition. Is it because the WHERE condition can't be used on database, but just on its tables?
How can I filter the tables that include 'trkw'?
Upvotes: 2
Views: 931
Reputation: 15905
Try this:
SHOW TABLES FROM mydatabase LIKE '*trkw*'
Upvotes: 2