X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5CA999FB3AD for ; Fri, 22 Sep 2006 11:57:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 78708-02 for ; Fri, 22 Sep 2006 11:57:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 11DC19FB31A for ; Fri, 22 Sep 2006 11:57:04 -0300 (ADT) Received: from 10.10.1.93 ([10.10.1.93]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Fri, 22 Sep 2006 14:57:00 +0000 Received: from localhost.localdomain by mail.g2switchworks.com; 22 Sep 2006 09:56:02 -0500 Subject: Re: Group by minute From: Scott Marlowe To: Ezequias Rodrigues da Rocha Cc: pgsql-sql@postgresql.org In-Reply-To: <55c095e90609220652t356c8591u412046aed091a52f@mail.gmail.com> References: <55c095e90609220652t356c8591u412046aed091a52f@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 22 Sep 2006 09:56:02 -0500 Message-Id: <1158936962.5218.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.083 tagged_above=0 required=5 tests=AWL, SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200609/155 X-Sequence-Number: 26366 On Fri, 2006-09-22 at 10:52 -0300, Ezequias Rodrigues da Rocha wrote: > Hil list, > > 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 ? > > Here is my query: > SELECT to_char(quando,'dd/MM/yyyy HH24:MI'),count(id) > FROM base.tentativa > WHERE (SESSAO_ID = 15) > GROUP BY to_char(quando,'dd/MM/yyyy HH24:MI') > order by 1 > Assuming that your IDE has the same issues with date_trunc, you could always put things into a view... in psql do something like: create view frozen_caveman_ide as SELECT to_char(quando,'dd/MM/yyyy HH24:MI'), count(id) FROM base.tentativa GROUP BY to_char(quando,'dd/MM/yyyy HH24:MI'); then just call the view when you need that.