On Feb 2, 2006, at 16:05 , Benjamin Arai wrote:

Is it possible to create a view from two different database tables?

Yes. You can create a view out of any query (i.e., SELECT statement). For example,

CREATE VIEW companies__members__view AS
SELECT company.company_name, member.given_name, member.family_name,
FROM companies
JOIN companies__members USING (company_id)
JOIN members USING (member_id);

Here's a couple of links to some of the documentation on views:
http://www.postgresql.org/docs/current/interactive/sql-createview.html
http://www.postgresql.org/docs/8.1/interactive/tutorial-views.html

Between different *databases* is another issue. You'll need to look at something like dblink (in contrib). If you think you might be doing this a lot you might want to consider making one database, separating out different sections in different schemas as necessary.

Hope this helps.

Michael Glaesemann
grzm myrealbox com




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to