Nacef LABIDI wrote:
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.

(select userid from orders where productid=1 UNION select userid from orders where productid=2) EXCEPT (select userid from orders where productid=1 EXCEPT select userid from orders where productid=2) EXCEPT (select userid from orders where productid=2 UNION select userid from orders where productid=1)

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to