exclusive OR possible within a where clause?

Поиск
Список
Период
Сортировка
От David Salisbury
Тема exclusive OR possible within a where clause?
Дата
Msg-id 4E9777F2.9030303@globe.gov
обсуждение исходный текст
Ответы Re: exclusive OR possible within a where clause?
Список pgsql-general
I'm guessing that this isn't possible, but you guys are pretty smart. :)
Short version, is there a way to implement an exclusive OR in a where clause?

table1
dt1(timestamp)
---------
3 mins
5 mins
7 mins

table2
dt2(timestamp),   timedifference(interval)
---------------  ----------------------
4 mins              1 min ( always positive )

I want to join these two tables, grabbing the row from table 1 that
has a time equal to table2's record + interval, but table 2 could
have values that fall smack dab in the middle of two table1 records,
and I don't want both.

select
   t1.dt1
from
   table1 t1,
   table2 t2
where
   t2.dt2 + t2.timedifference = t1.dt1
     XOR ;-)
   t2.dt2 - t2.timedifference = t1.dt1

It's not important which of the two closest times
I get, but would like to get just one without being
messy.

Thanks for any ideas.  Maybe there's a great function out there
that solves this?

Dave










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

Предыдущее
От: Anthony Presley
Дата:
Сообщение: Re: Drill-downs and OLAP type data
Следующее
От: David Salisbury
Дата:
Сообщение: Re: Error: timestamp with timezone + interval is not immutable while creating index