Skip site navigation (1) Skip section navigation (2)

How to do A union (B - ( A intersect B )) or sort of :-)

From: A B <gentosaker(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: How to do A union (B - ( A intersect B )) or sort of :-)
Date: 2010-11-04 19:53:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

Sorry for the subject, but I knew no words to describe it better.
I will try to explain

First a more general question: is there any clever way  to do two
selects A and B and then return the result
A union ( B \ (A intersect B))      ( \ is "set subtraction")

Any ideas besides writing the explicit queries? I guess one has to
lock the table to get the same result on both selects unless one can
cache the result of A and B so you don't run it twice?

Then the actual problem at hand, which with extra details might result
in another solution then the one from above.

A looks like    select,,true from X
B looks like    select,,false from Y

can one then use the differences in boolean values in some clever way,
like  OR  operation?


pgsql-novice by date

Next:From: Tom LaneDate: 2010-11-04 20:43:41
Subject: Re: How to do A union (B - ( A intersect B )) or sort of :-)
Previous:From: Thomas KellererDate: 2010-11-04 16:53:59
Subject: Re: Function to spell out a number

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group