.TO_CHAR problem - Mailing list pgsql-general

From Guillaume Lémery
Subject .TO_CHAR problem
Date
Msg-id 3A8BEEC9.4090707@comclick.com
Whole thread Raw
Responses Re: .TO_CHAR problem
List pgsql-general
Hi all,

I want to have some stats from my data grouped by 2hours periodes.

Here is the query :

SELECT TO_DATE(TO_CHAR    (date_clic,'DD-MM-YYYY ')
        ||     (TO_CHAR(
                TO_NUMBER(
                    TO_CHAR(date_clic,'hh24')
                , 99)
                     - mod(
                         TO_NUMBER(
                             TO_CHAR(date_clic,'hh24')
                         , 99)
                     ,2)
                 , 'hh24')
                 )
             ||':00','DD-MM-YYYY HH24:MI') AS date_debut
FROM clic_campagne;

But I only get the date whithout the hours and the minute, how can I get
them ?

Thanx,

Guillaume.


pgsql-general by date:

Previous
From: Louis-David Mitterrand
Date:
Subject: last UPDATE or INSERT time of a table?
Next
From: Tom Lane
Date:
Subject: Re: Max query limit in 7.1? With TOAST?