From: | Madison Kelly <linux(at)alteeve(dot)com> |
---|---|
To: | pgsql general list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: SELECT from multiple tables (not join though) |
Date: | 2005-01-10 19:43:45 |
Message-ID: | 41E2DAF1.9050309@alteeve.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-01-10 20:30:45 | Re: does "select count(*) from mytable" always do a seq |
Previous Message | Michael Fuhr | 2005-01-10 19:16:04 | Re: Function for retreiving datatype |