Link to home
Start Free TrialLog in
Avatar of erzoolander
erzoolander

asked on

Select * FROM all tables? MySQL

I've got a database I'm working with where there's an ever expanding number of tables - associated by a specific row (let's call it "blah").

Instead of doing joins - is there syntax for me to basically say...

"SELECT * FROM all tables
WHERE blah = 'whatever'

?
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

assuming blah is a column name and string, use:

SELECT blah FROM Table1
WHERE blah = 'whatever'

will work.

If there another table with field blah, then use:

SELECT blah FROM Table1 Union
SELECT blah FROM Table2
WHERE blah = 'whatever'

and so on.

There is a way to query system tables to get the names and the [blah]s exist in the database and then design a proc to search for the information you need.

Mike
SOLUTION
Avatar of Bitaseme Mboe
Bitaseme Mboe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial