From: | "Denis" <sqllist(at)coralindia(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: max timestamp |
Date: | 2004-02-16 08:57:54 |
Message-ID: | 00b001c3f46a$f9101f80$0f32a8c0@denisnew |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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: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" <stermic(at)gw(dot)co(dot)jackson(dot)mo(dot)us>
To: <pgsql-sql(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Kumar | 2004-02-16 12:10:08 | Getting the week of a date |
Previous Message | Sumita Biswas (sbiswas) | 2004-02-16 08:12:01 | Re: Function |