pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo De León <rdeleonp@gmail.com>
To: Andreas Joseph Krogh <andreak@officenet.no>
Cc: pgsql-sql@postgresql.org
Subject: Re: Alternative to INTERSECT
Date: Tue, 31 Jul 2007 15:30:17 -0500
Message-ID: <a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com> (raw)
In-Reply-To: <200707311730.51280.andreak@officenet.no>
References: <200707311730.51280.andreak@officenet.no>

On 7/31/07, Andreas Joseph Krogh <andreak@officenet.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%';



view thread (6+ messages)  latest in thread

Message-ID: <a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com>
Permalink:  ../a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com/
Also on:    postgresql.org/message-id/a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rdeleonp@gmail.com, andreak@officenet.no
  Subject: Re: Alternative to INTERSECT
  In-Reply-To: <a55915760707311330g7e977a63wbb616023d5d2563a@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox