Josh Moore
Josh Moore

Reputation: 13568

Querying across schemas in Postgres

I am using Postgres and I have multiple schemas (i.e. S1 and S2). I would like to run a query that uses tables in S1 and S2. is it possible to do something like this:

select * from S1.table1, S2.table2

Thanks for all replies.

Upvotes: 20

Views: 33972

Answers (2)

gc5
gc5

Reputation: 9898

Indeed, I think that the correct query is:

select * from S1.table1
UNION ALL
select * from S2.table2

Upvotes: 3

user80168
user80168

Reputation:

Yes. And the syntax is exactly how you wrote.

Upvotes: 29

Related Questions