Re: exclusive OR possible within a where clause?

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: exclusive OR possible within a where clause?
Дата
Msg-id 20111014165837.GB32530@fetter.org
обсуждение исходный текст
Ответ на Re: exclusive OR possible within a where clause?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: exclusive OR possible within a where clause?
Список pgsql-general
On Thu, Oct 13, 2011 at 07:49:59PM -0400, Tom Lane wrote:
> David Salisbury <salisbury@globe.gov> writes:
> > Short version, is there a way to implement an exclusive OR in a where clause?
>
> The boolean <> operator will do the trick.
>
>     (x = y) <> (a = b)
>
>             regards, tom lane

Factoring in NULLable columns, that's:

(x IS NOT DISTINCT FROM y) <> (a IS NOT DISTINCT FROM b)

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

В списке pgsql-general по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Confused About pg_* Tables
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Confused About pg_* Tables