Filter tables - Mailing list pgsql-general

From Reg Me Please
Subject Filter tables
Date
Msg-id 200711121643.51645.regmeplease@gmail.com
Whole thread Raw
Responses Re: Filter tables  (Dimitri Fontaine <dfontaine@hi-media.com>)
Re: Filter tables  (Erik Jones <erik@myemma.com>)
List pgsql-general
Hi all.

I have this sample setup:

CREATE table t1 ( t text, id int );
CREATE TABLE f1 ( t text );

INSERT INTO t1 VALUES
  ( 'field1',1 ),
  ( 'field2',1 ),
  ( 'field3',1 ),
  ( 'field1',2 ),
  ( 'field3',3 )
;

INSERT INTO f1 VALUES
  ( 'field1' ),
  ( 'field2' )
;

What I'd need to do is to "filter" t1 against f1 to get only the rows
( 'field1',1 ) and ( 'field2',1 ).
Of course both t1 and f1 don't have a defined number of rows, though usually
t1 should be much bigger that f1.

I have a rather complex solution in mind with loops in a plpgsql function and
am wondering whether there is one simpler.

Thanks a lot.

--
Reg me Please

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Linux v.s. Mac OS-X Performance
Next
From: "Gauthier, Dave"
Date:
Subject: reverse strpos?