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

Поиск
Список
Период
Сортировка
От A B
Тема How to do A union (B - ( A intersect B )) or sort of :-)
Дата
Msg-id AANLkTikocZwZMmmkzihV+0Oqjb_F5uaZFMAassKVrBOS@mail.gmail.com
обсуждение исходный текст
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Function to spell out a number
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to do A union (B - ( A intersect B )) or sort of :-)