0

Using postgres 9.4 and PGAdmin III: I have a schema with 250 tables. 53 of these tables have a column value (int) that is sourced from another table. I would like to have a list of the table names and the row ID from the 53 tables that may contain a value from the source table.

Source table: ID, LABEL, VALUE, ...

Other tables: ID, LABEL, VALUE_FROM_SOURCE, ...

Something like;

SELECT table_name, ID from (list of tables) WHERE VALUE_FROM_SOURCE = (source table value)

I tried UNION ALL, but I can't seem to get table names, only that the value exists in the entire list (or not).

Ken White
  • 123,280
  • 14
  • 225
  • 444

0 Answers0