Re: Performing intersection without intersect operator - Mailing list pgsql-sql

From Oliveiros Cristina
Subject Re: Performing intersection without intersect operator
Date
Msg-id 017501c938f3$75c0ae60$ec5a3d0a@marktestcr.marktest.pt
Whole thread Raw
In response to Performing intersection without intersect operator  ("Nacef LABIDI" <nacef.l@gmail.com>)
List 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 -----
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

pgsql-sql by date:

Previous
From: "Nacef LABIDI"
Date:
Subject: Performing intersection without intersect operator
Next
From: Peter Eisentraut
Date:
Subject: Re: Performing intersection without intersect operator