Reputation: 115
My Database contains tables names as mentioned below and I need the tables not containing underscore(_) values:
table1
table1_xyz
table1_xyz_abc
table2
table2_xyz
table2_xyz_abc
from above example I need only talbe1 and table2 to be fetched from the query, the query used to fetch all tables names Not containing underscore(_) values in my DataBaseName:
select table_name from information_schema.tables where table_schema = 'DataBaseName' and ( table_name NOT like '%_' OR table_name NOT like '_%' OR table_name NOT like '%_%')
but there are no results fetched.
any advice.
Upvotes: 0
Views: 293
Reputation: 1
use this select table_name from information_schema.tables where table_schema = 'DataBaseName' and ( table_name NOT like '%\_' OR table_name NOT like '\_%' OR table_name NOT like '%\_%')
Upvotes: 0