pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mezei Zoltán <mezei.zoltan@telefor.hu>
To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Group by minute
Date: Fri, 22 Sep 2006 16:14:41 +0200
Message-ID: <4513EFD1.1010500@telefor.hu> (raw)
In-Reply-To: <55c095e90609220652t356c8591u412046aed091a52f@mail.gmail.com>
References: <55c095e90609220652t356c8591u412046aed091a52f@mail.gmail.com>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000099">
Ezequias Rodrigues da Rocha wrote:
<blockquote
 cite="mid55c095e90609220652t356c8591u412046aed091a52f@mail.gmail.com"
 type="cite">Hil list,<br>
  <br>
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 ?<br>
  <br>
Here is my query:<br>
SELECT  to_char(quando,'dd/MM/yyyy HH24:MI'),count(id)
  <br>
FROM base.tentativa<br>
WHERE  (SESSAO_ID = 15) <br>
GROUP BY to_char(quando,'dd/MM/yyyy HH24:MI')<br>
order by 1<br>
  <br>
</blockquote>
That seems like a valid query in Oracle :-)<br>
<br>
Postgres have a slightly different mechanism for handling date and
time. The modified query:<br>
<br>
SELECT  date_trunc('minute', quando),count(id)
<br>
FROM base.tentativa<br>
WHERE  (SESSAO_ID = 15) <br>
-- GROUP BY to_char(quando,'dd/MM/yyyy HH24:MI')<br>
GROUP BY date_trunc('minute', quando)<br>
order by 1<br>
<br>
You should read:<br>
<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html">http://www.postgresql...;
<br>
Zizi<br>
</body>
</html>



view thread (4+ messages)  latest in thread

Message-ID: <4513EFD1.1010500@telefor.hu>
Permalink:  ../4513EFD1.1010500@telefor.hu/
Also on:    postgresql.org/message-id/4513EFD1.1010500@telefor.hu

 · 

reply

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: mezei.zoltan@telefor.hu, ezequias.rocha@gmail.com
  Subject: Re: Group by minute
  In-Reply-To: <4513EFD1.1010500@telefor.hu>

* 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