Hi Michael,

Try this..

ace=> create table test( mytime timestamp );
CREATE
ace=> insert into test values (now() );
INSERT 1823542 1
ace=> insert into test values (now() );
INSERT 1823543 1
ace=> insert into test values (now()-1);
INSERT 1823544 1
ace=> insert into test values (now()-1);
INSERT 1823545 1
ace=> insert into test values (now()-2);
INSERT 1823546 1
ace=> select * from test;
              mytime
----------------------------------
 2004-02-16 14:27:15.936368+05:30
 2004-02-16 14:27:20.888205+05:30
 2004-02-15 00:00:00+05:30
 2004-02-15 00:00:00+05:30
 2004-02-14 00:00:00+05:30
(5 rows)
 
ace=> select to_char(mytime,'dd-mm-yyyy'),max(mytime) from test group by 1;
  to_char   |               max
------------+----------------------------------
 14-02-2004 | 2004-02-14 00:00:00+05:30
 15-02-2004 | 2004-02-15 00:00:00+05:30
 16-02-2004 | 2004-02-16 14:27:20.888205+05:30
(3 rows)
 
HTH

Thanx

Denis



----- Original Message ----- 
From: "Michael Sterling" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 10, 2004 11:44 PM
Subject: [SQL] max timestamp


> i'm trying to get the max time stamp, from each day, of a range of
> dates, not just the max time stamp for the complete range dates but
> for each day.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to