Perfect Dieter, worked GREAT
I am using Postgresql and it did the job
Thank you for all the help,
Sean - HeliHobby.com
"Dieter Noeth" <dnoeth@gmx.dewrote in message
news:dolnq1$isk$1@online.de
News wrote:
>
>I am trying to group a timestamp column by date only
>The following statement does not work since the column date_entered
>includes both date and time so the GRUP BY does not group the proper way
>I wish it to
>>
>>
>>
>SELECT SUM(subtotal), count(*), date_entered FRM orders WHERE
>date_entered 12/24/2004 GRUP BY date_entered RD
>ER BY date_entered;"
>
SELECT SUM(subtotal), count(*), CAST(date_entered AS DATE)
FRM orders
WHERE date_entered 12/24/2004
GRUP BY CAST(date_entered as DATE)
RDER BY CAST(date_entered as DATE);
If you can't use the CAST within GRUP BY, use a Derived Table instead:
SELECT SUM(subtotal), count(*), d
FRM
(
SELECT subtotal, CAST(date_entered AS DATE) as d
FRM orders
WHERE date_entered 12/24/2004
) dt
GRUP BY d
RDER BY d;
Dieter