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

From Alvaro Herrera
Subject Re: SELECT from multiple tables (not join though)
Date
Msg-id 20050110180047.GA24404@dcc.uchile.cl
Whole thread Raw
In response to Re: SELECT from multiple tables (not join though)  (Madison Kelly <linux@alteeve.com>)
List pgsql-general
On Mon, Jan 10, 2005 at 12:47:53PM -0500, Madison Kelly wrote:

Madison,

> 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 get the Oid of the table very easily with the "tableoid" column.
If you want the name you can use tableoid::regclass, though I'm not sure
if that works as a normal text column.

Be sure to grok the difference between UNION and UNION ALL (which is the
fact that UNION sorts and "uniqs" its input).

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
Oh, oh, las chicas galacianas, lo harán por las perlas,
¡Y las de Arrakis por el agua! Pero si buscas damas
Que se consuman como llamas, ¡Prueba una hija de Caladan! (Gurney Halleck)

pgsql-general by date:

Previous
From: Madison Kelly
Date:
Subject: Re: SELECT from multiple tables (not join though)
Next
From: Madison Kelly
Date:
Subject: Re: SELECT from multiple tables (not join though)