Youssef
Youssef

Reputation: 50

How to find columns/tables with certain row values inside it

I'm trying to fetch all the table name with certain column value inside it. For example, table A has 3 columns, one of these columns has the value 'testvalue' table b has 6 columns, one of these columns has the value 'testvalue'
I want to get table a and b names, is there any query to do this?

Upvotes: 0

Views: 40

Answers (1)

Bruno
Bruno

Reputation: 71

To get all tables with a specific column name.

SELECT table_name, column_name
FROM information_schema.columns
WHERE column_name = 'testvalue'

Upvotes: 1

Related Questions