Re: Performing intersection without intersect operator

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Nacef LABIDI" <nacef(dot)l(at)gmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Performing intersection without intersect operator
Date: 2008-10-28 11:51:05
Message-ID: 017501c938f3$75c0ae60$ec5a3d0a@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Howdy, Nacef,

Try this,

SELECT a.userid
FROM orders a
JOIN orders b
USING (userid)
WHERE a.productid = 1
AND b.productid = 2

Best,
Oliveiros

----- Original Message -----
From: Nacef LABIDI
To: pgsql-sql(at)postgresql(dot)org
Sent: Tuesday, October 28, 2008 11:14 AM
Subject: [SQL] Performing intersection without intersect operator

Hi all,

I want to perform an intersection between several select queries but without using the INTERSECT keyword.

select userid from orders where productid=1 INTERSECT select userid from orders where productid=2

I want to transform it without the INTERSECT.

Thanks to all

Nacef

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2008-10-28 11:59:36 Re: Performing intersection without intersect operator
Previous Message Nacef LABIDI 2008-10-28 11:14:24 Performing intersection without intersect operator