Re: show data from two tables together

From: "Matthew Nuzum" <cobalt(at)bearfruit(dot)org>
To: "'Stephan Szabo'" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "'Matthew Nuzum'" <cobalt(at)bearfruit(dot)org>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: show data from two tables together
Date: 2003-01-16 03:46:48
Message-ID: 000001c2bd11$e76058e0$6700a8c0@mattspc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hmm... I've never used this before. I'll try it.

Thanks for your help and your quick reply!

--
Matthew Nuzum
www.bearfruit.org
cobalt(at)bearfruit(dot)org

> Fortunately we have the set functions, specifically UNION ALL in this
> case.
>

> Maybe something like (minus the number of files/empty part):
>
> CREATE VIEW viewname AS
> SELECT fileid, filename, folderid, dsply_order FROM files
> UNION ALL
> SELECT folderid, foldername, parentid, dsply_order FROM folders;
>
> SELECT * from viewname where folderid=23 order by dsply_order;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-01-16 04:20:22 Re: RFC: A brief guide to nulls
Previous Message Stephan Szabo 2003-01-16 03:26:08 Re: show data from two tables together