Re: WHERE clause with timestamp data type - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: WHERE clause with timestamp data type
Date
Msg-id 20070827052423.GA13996@a-kretschmer.de
Whole thread Raw
In response to WHERE clause with timestamp data type  (Chirag Patel <patelc75@yahoo.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: WHERE clause with timestamp data type
Next
From: "Andrew C. Uselton"
Date:
Subject: unattended backups