Tuesday, May 14, 2013

How do you find all the tables with specific column names in MySQL?

SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ( 'ColumnA', 'ColumnB' )
AND TABLE_SCHEMA = 'DatabaseName';

No comments :