杜龙少(sdvdxl)

sql查找排除某些表后不存在某个字段的表

Word count: 53 / Reading time: 1 min
2016/03/09 Share
1
2
3
4
5
6
7
8
SELECT table_name FROM information_schema.tables
WHERE table_schema='database_name'
AND table_name NOT LIKE 'table_name'
AND table_name NOT IN(SELECT col.table_name FROM information_schema.`COLUMNS` col
WHERE col.table_name IN (SELECT table_name FROM information_schema.tables
WHERE table_schema='database_name'
AND table_name NOT LIKE 'table_name'
AND col.column_name='gmt_modified');
CATALOG