Re: question about to return two diferent tables from a function

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: hildebardo(at)prodigy(dot)net(dot)mx
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: question about to return two diferent tables from a function
Date: 2005-09-24 04:07:58
Message-ID: 20050924040757.GA23964@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 23, 2005 at 07:55:32PM -0500, hildebardo(at)prodigy(dot)net(dot)mx wrote:
> I have two tables
[...]
> then I need to join the two tables in a function like this
>
> doc|date |id
> 1 |2005-09-22| 50
> 2 |2005-09-21| 50
> 12 |2005-09-01| 20
> 13 |2005-09-21| 24
> 14 |2005-09-22| 31

This doesn't look like a join of the two tables; it looks instead
like a union. Is this the query you're looking for?

SELECT doc, date, id_customer AS id FROM first_one
UNION ALL
SELECT doc, date, id_code AS id FROM second_one;

--
Michael Fuhr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2005-09-24 05:36:50 Re: Backend crash with user defined aggregate
Previous Message Matthew Peter 2005-09-24 03:01:40 Re: array_dims array_lower/upper distance