Sometimes when using MySQL, you need to know every table that contains a given column name. In the past I've accomplished this with a short script, but I've come to find out that you can simply use a SQL statement instead.
SELECT table_name FROM information_schema.COLUMNS WHERE table_schema='my_db' AND column_name='MyColumn';
Thursday, June 19, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
For those desperately trying to find the Ingres version of this select:
SELECT table_name
FROM iicolumns
WHERE column_name = 'MyColumn';
Thanks for the credit, Travis. :p
Post a Comment