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
2009-03-17 15:02:02
Yes, MySQL has that too and the Statement works fine, but why are you using "like" without any wildcard instead of "=" ?
Tim Büthe
2009-03-17 15:07:46
Copy/pasted it from a quick test on our DB here where i was using a wildcard, fixed now - ta! :)
Town
2009-03-17 15:11:02