How to do A union (B - ( A intersect B )) or sort of :-) - Mailing list pgsql-novice

From A B
Subject How to do A union (B - ( A intersect B )) or sort of :-)
Date
Msg-id AANLkTikocZwZMmmkzihV+0Oqjb_F5uaZFMAassKVrBOS@mail.gmail.com
Whole thread Raw
Responses Re: How to do A union (B - ( A intersect B )) or sort of :-)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: How to do A union (B - ( A intersect B )) or sort of :-)  (Andreas <maps.on@gmx.net>)
List pgsql-novice
Hi.

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   a.id,a.name,true from X
B looks like    select   b.id,b.name,false from Y

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

pgsql-novice by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Function to spell out a number
Next
From: Tom Lane
Date:
Subject: Re: How to do A union (B - ( A intersect B )) or sort of :-)