tags:

views:

187

answers:

1

mysql: get all tables in database that have a column called xyz

+5  A: 

This works in SQL Server and i believe MySql has an Information_Schema Columns table: http://dev.mysql.com/doc/refman/5.1/en/columns-table.html

select c.table_name from 
information_schema.columns c 
where c.column_name = 'xyz'
Town
Yes, MySQL has that too and the Statement works fine, but why are you using "like" without any wildcard instead of "=" ?
Tim Büthe
Copy/pasted it from a quick test on our DB here where i was using a wildcard, fixed now - ta! :)
Town