Robert Hosking
Robert Hosking

Reputation: 134

MySQL Querying Multiple Databases

I have multiple databases and I need to search for a value in a table and set it to NULL in all instances across all databases.

I know how to query individual databases after "USE 'DBName'" is called to select a particular database.

How do I loop all databases?

Upvotes: 0

Views: 60

Answers (1)

Shira
Shira

Reputation: 6560

Use the SHOW DATABASES query to list all databases.

You don't need to USE the database to query its tables:

SELECT something FROM databasename.sometable

Upvotes: 2

Related Questions