Re: max timestamp - Mailing list pgsql-sql

From Denis
Subject Re: max timestamp
Date
Msg-id 00b001c3f46a$f9101f80$0f32a8c0@denisnew
Whole thread Raw
In response to max timestamp  (stermic@gw.co.jackson.mo.us (Michael Sterling))
List pgsql-sql
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:302004-02-16 14:27:20.888205+05:302004-02-15
00:00:00+05:302004-02-1500:00:00+05:302004-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:3015-02-2004 | 2004-02-15
00:00:00+05:3016-02-2004| 2004-02-16 14:27:20.888205+05:30
 
(3 rows)
HTH

Thanx

Denis



----- Original Message ----- 
From: "Michael Sterling" <stermic@gw.co.jackson.mo.us>
To: <pgsql-sql@postgresql.org>
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




pgsql-sql by date:

Previous
From: "Denis"
Date:
Subject: Re: ORDER BY TIMESTAMP_column ASC, NULL first
Next
From: "Kumar"
Date:
Subject: Getting the week of a date