Re: filtering after join - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: filtering after join
Date
Msg-id 20060125175338.GA76400@winnie.fuhr.org
Whole thread Raw
In response to filtering after join  (andrew <andrew.ylzhou@gmail.com>)
List pgsql-sql
On Wed, Jan 25, 2006 at 06:27:33PM +0100, andrew wrote:
> I want to use a UDF to filter tuples t that are generated after a join.
> More specifially, I have a UDF foo(record), which computes a value for
> a given tuple.  I can do the filtering before the join. e.g.:
> 
> select * from A, B where foo(A)<2 and A.a=B.b;
> 
> But I want to apply foo() to the tuples generated by the join
> operation. How can I do that?

Is this what you're looking for?

select *
from (select * from A, B where A.a = B.b) as s
where foo(s) < 2;

-- 
Michael Fuhr


pgsql-sql by date:

Previous
From: "Owen Jacobson"
Date:
Subject: Re: psql in the command line
Next
From: Peter Eisentraut
Date:
Subject: Re: filtering after join