Re: Alternative to INTERSECT

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: "Andreas Joseph Krogh" <andreak(at)officenet(dot)no>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Alternative to INTERSECT
Date: 2007-07-31 20:30:17
Message-ID: a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 7/31/07, Andreas Joseph Krogh <andreak(at)officenet(dot)no> wrote:
> Is there a way to make this more efficient with another construct, or
> INTERSECT the only way to accomplish the desired result?

SELECT f1.ID
FROM TEST f1 JOIN TEST f2 ON f1.ID = f2.ID
JOIN TEST f3 ON f2.ID = f3.ID
WHERE f1.FIELD = 'firstname'
AND f1.VALUE LIKE 'andrea%'
AND f2.FIELD = 'firstname'
AND f2.VALUE LIKE 'jose%'
AND f3.FIELD = 'lastname'
AND f3.VALUE LIKE 'kro%';

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2007-07-31 21:09:07 Re: Alternative to INTERSECT
Previous Message Andreas Joseph Krogh 2007-07-31 19:45:10 Re: Alternative to INTERSECT