Re: WHERE clause with timestamp data type

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: WHERE clause with timestamp data type
Дата
Msg-id 20070827052423.GA13996@a-kretschmer.de
обсуждение исходный текст
Ответ на WHERE clause with timestamp data type  (Chirag Patel <patelc75@yahoo.com>)
Список pgsql-novice
am  Sun, dem 26.08.2007, um 21:49:29 -0700 mailte Chirag Patel folgendes:
> The following command works great,
> SELECT AVG(column) FROM table WHERE timestamp > 2007-08-23;
>
> But when I try it with finer resolution (hour, minutes, seconds) like this, I
> get a syntax error
> SELECT AVG(heartrate) FROM heartrates WHERE timestamp > 2007-08-23 19:48:09;

Can you show us the error?


>
> Do I need to convert from string format to total number of seconds? Any ideas
> on how to get this work?

Try: "WHERE timestamp > '2007-08-23 19:48:09'::timestamp ";


Btw.: bad idea to title a column 'timestamp', because this is a
datatype-identifier - but it works.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: WHERE clause with timestamp data type
Следующее
От: "Andrew C. Uselton"
Дата:
Сообщение: unattended backups