-----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...

On Jan 10, 2005, at 1:24 PM, Madison Kelly wrote:

Bruno Wolff III wrote:
On Mon, Jan 10, 2005 at 12:47:53 -0500,
  Madison Kelly <[EMAIL PROTECTED]> wrote:
The trick now is I need to know which table each result came from. I can add another column and record the table number and SELECT that at the same time but before I do I was wondering if I can do this more efficiently or elegantly.
You can add a constant to the select list in each of the subselects
that indicates which table is being used.

^.^; Can you point me to docs that will help me learn how to do that? Thanks! Or rather, do you mean add a column to the table with an ID for the table that I select beside the file_name? If so, that is what I am planning to do if I can't find a smoother way to do it.


Thanks!!

Madison

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?


              http://archives.postgresql.org


- -----------------------------------------------------------
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)


iD8DBQFB4s/o7aqtWrR9cZoRAuYtAJ95XxbFAcfK5MBDU+sC4ktulxqfwwCfbIfM
mjQKofx230j5myapOSbGCAc=
=WEWW
-----END PGP SIGNATURE-----



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com


---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend

Reply via email to