Re: [GENERAL] Max function on Timestamp

From: José Soares <jose(at)sferacarta(dot)com>
To: Esteban Chiner Sanz <echiner(at)tissat(dot)es>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [GENERAL] Max function on Timestamp
Date: 1999-09-02 12:29:26
Message-ID: 37CE6DA6.B40F424E@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

It works for me (v6.5.1)
I have the following MAX aggregates:

prova=> \da max
aggname|type |description
-------+--------+-----------
max |abstime |
max |date |
max |datetime|
max |float4 |
max |float8 |
max |int2 |
max |int4 |
max |int8 |
max |money |
max |numeric |
max |text |
max |timespan|
(12 rows)

...
prova=> insert into test values (current_timestamp);
INSERT 720683 1
prova=> select data from test;
data
----------------------
1999-09-02 16:14:24+02
1999-09-02 16:14:27+02
1999-09-02 16:14:53+02
(3 rows)

prova=> select max(data) from test;
max
---------------------------
02/09/1999 16:14:53.00 CEST
(1 row)

If it doesn't work for you try to run the attached script.

José

Esteban Chiner Sanz ha scritto:

> I have a table in my database with a timestamp field and I can't use a
> max function on it. You can do it with any other date types (date,
> timespan, etc.) but not with timestamp.
> Is there any problem on doing it? Why isn't it implemented in PostgreSQL
> 6.5.1? What would be the easiest way of doing it?
> Thank you in advance,
>
> Esteban Chiner
>
> P.D: There aren't also any "less than" or "greater than" operators on
> timestamp...
>
> ------------------------------------------------------------
> Esteban Chiner Sanz mailto (work): echiner(at)tissat(dot)es
> TISSAT
> Av. Aragon, 30, 5ª planta Phone: 96 393 9950
> Valencia (SPAIN)
>
> ************

Attachment Content-Type Size
min_max.sql text/plain 3.5 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 1999-09-02 12:45:31 Re: [GENERAL] GEQO and KSQO problem.
Previous Message Natalya S. Makushina 1999-09-02 08:45:16 GEQO and KSQO problem.

Browse pgsql-sql by date

  From Date Subject
Next Message Heiko Wilms 1999-09-02 14:44:18 character type "text"
Previous Message Tim Pizey 1999-09-02 10:36:17 Re: [SQL] Newbie dbadmin out of his league