Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL problem using count and group by with date datatype

SQL problem using count and group by with date datatype

From: <smceneaney_at_my-deja.com>
Date: Tue, 07 Sep 1999 15:24:27 GMT
Message-ID: <7r3am9$kuk$1@nnrp1.deja.com>


I want to count records in a table using group by on a date datatype. The problem is that I want to use ONLY the dd-mon-yy part of the date in the count function and group by function. I want to group by the day part of the date field and not day and time. The SQL query below fails

select count(register_date), to_char(register_date, 'dd-mon-yy') from user_table
where (register_date - to_date('01-Aug-99', 'dd-mon-yy') > 0) order by to_char(register_date, 'dd-mon-yy')

with the following error

ERROR at line 1:
ORA-00937: not a single-group group function

The result I want to get is something like this

5     1-AUG-99
7     2-AUG-99
99    4-AUG-99
100   9-AUG-99
150   12-AUG-99
8     13-AUG-99

89 21-AUG-99 Can anybody tell me what I'm doing wrong??

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Sep 07 1999 - 10:24:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US