query for a time interval

Поиск
Список
Период
Сортировка
От Mark
Тема query for a time interval
Дата
Msg-id 20051221195256.86505.qmail@web31913.mail.mud.yahoo.com
обсуждение исходный текст
Ответы view or index to optimize performance  (Klein Balázs <Balazs.Klein@axelero.hu>)
Re: query for a time interval  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: query for a time interval  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
Hello everybody,

I'm looking for an elegant SQL statement that will work in
Postgresql, MySQL and ORACLE.
The query will be executed by Java client.

To have this query for Postgresql is priority number one.


In this query I try to get a list of message Ids that expired.

time_to_live is in seconds.

SELECT id
  FROM mq
 WHERE now - start_date > time_to_live;

I have a following table:

CREATE TABLE mq
{
msg_id INTEGER,
retry_date  TIMESTAMP NOT NULL DEFAULT ('now'::text)::timestamp(1),
start_date  TIMESTAMP NOT NULL DEFAULT ('now'::text)::timestamp(1),
time_to_live INTEGER
}

Thanks!
Mark.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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

Предыдущее
От: Jerry LeVan
Дата:
Сообщение: Funky template1 problem?
Следующее
От: S McLurkin
Дата:
Сообщение: contrib extenstions