Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 23, 2005 at 07:55:32PM -0500, hildebardo@xxxxxxxxxxxxxx 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

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

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux