Skip site navigation (1) Skip section navigation (2)

Re: Return data from function

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: "Alexander B(dot)" <burbello3000(at)yahoo(dot)com(dot)br>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Return data from function
Date: 2007-04-20 18:25:46
Message-ID: 20070420182545.GN72669@nasby.net (view raw or flat)
Thread:
Lists: pgsql-admin
The magic you're looking for is UNION ALL.

You could just union the two address tables together and join that to
the address code table, but that'll probably lead to an inefficient
plan. You'll likely need to join the address code table to each address
table separately, and then UNION ALL those together.

On Tue, Apr 17, 2007 at 04:17:36PM -0300, Alexander B. wrote:
> Hello,
> 
> I need to create a function that find data over 3 tables, merge and
> return data.
> With example can be specified more clearly:
> 
> 1.1 Find all addresses code;
> 1.2 For each addresses code, get address, complement and city on the
> first table;
> 1.3 For each addresses code, get address, complement and city on the
> second table;
> 1.4 Merge result from first and second tables and return to the function;
> 
> I would like to do not using cursor.
> Do you have any ideas how to implement?
> 
> Thanks in advance.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
> 

-- 
Jim Nasby                                            jim(at)nasby(dot)net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

In response to

pgsql-admin by date

Next:From: Michael FuhrDate: 2007-04-21 07:04:21
Subject: Re: Get information from SMNP
Previous:From: Jim C. NasbyDate: 2007-04-20 18:17:33
Subject: Re: Ditributed PosgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group