postgresql - Querying across multiple tables with identical schemas -
i'm trying run same query on multiple tables in postgres database, have same schema.
this question: select multiple tables without join? shows possible, hard-coding set of tables.
i have query returns 5 specific tables main query run on. how can go using result of union approach?
in short, want query see 5 specific tables (determined outcome of query) 1 large table when runs query.
i understand in many cases similar scenario you'd want merge tables. can not this.
one way of doing may satisfy constraints using table inheritance. in short, need create parent table same schema, , each child want query must alter that_table inherit parent_table
. queries against parent table query of child tables. if need query different tables in different circumstances, think best way add column named type
or such, , query values of table.
Comments
Post a Comment