Re: SELECT from multiple tables (not join though) - Mailing list pgsql-general

From Madison Kelly
Subject Re: SELECT from multiple tables (not join though)
Date
Msg-id 41E2DAF1.9050309@alteeve.com
Whole thread Raw
In response to Re: SELECT from multiple tables (not join though)  ("Frank D. Engel, Jr." <fde101@fjrhome.net>)
List pgsql-general
Frank D. Engel, Jr. wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> SELECT file_name, 1 FROM file_info_1 WHERE file_parent_dir='/' UNION
> SELECT file_name, 2 FROM file_info_2 WHERE file_parent_dir='/' UNION
> SELECT file_name, 3 FROM file_info_3 WHERE file_parent_dir='/'
> ORDER BY file_name;
>
> The second column now shows which table it came from.  No need to mess
> with adding fields, OIDs, etc...

Thank you Frank, Bruno and Derik,

   That worked wonderfully! Derik's suggestion also worked perfectly,
too. I would imagine this method is slightly faster that his because I
am not really assigning anything? I guess I will need to run some
benchmarks. It is really nice to have options though.

   Thank you all again! The amount of time you guys have saved me since
I joined is just phenominal!

Madison


pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Function for retreiving datatype
Next
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: Function for retreiving datatype