Re: Group by minute

From: Niklas Johansson <spot(at)tele2(dot)se>
To: "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Group by minute
Date: 2006-09-22 14:10:54
Message-ID: F65F089C-5162-49EE-9D17-0F8ACA48ADE6@tele2.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On 22 sep 2006, at 15.52, Ezequias Rodrigues da Rocha wrote:
> I have a query but my IDE (Delphi) does not accept "to_char"
> capability. Is there a way to reproduce the same query without
> using to_char function ?
>
> ...
> GROUP BY to_char(quando,'dd/MM/yyyy HH24:MI')

To group by minute, you can try

GROUP BY date_trunc('minute', quando)

or even

GROUP BY EXTRACT(EPOCH FROM quando)::integer / 60

Sincerely,

Niklas Johansson

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mezei Zoltán 2006-09-22 14:14:41 Re: Group by minute
Previous Message Ezequias Rodrigues da Rocha 2006-09-22 13:52:00 Group by minute