From: Denis <sqllist@coralindia.com>
To: pgsql-sql@postgresql.org
Subject: Re: max timestamp
Date: Mon, 16 Feb 2004 14:27:54 +0530
Message-ID: <00b001c3f46a$f9101f80$0f32a8c0@denisnew> (raw)
References: <f7359f44.0402101014.77198f7b@posting.google.com>
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@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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sqllist@coralindia.com
Subject: Re: max timestamp
In-Reply-To: <00b001c3f46a$f9101f80$0f32a8c0@denisnew>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox