Message-Id: <10683.122407@fatcity.com> From: "Eunhee lee" Date: Fri, 17 Nov 2000 14:53:20 -0500 Subject: Is there fast way to group by MMYY ( date type) This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C050D0.090954C0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit I'm having a hard time to group by month. subs table has id, and sub_date (date type) and it's huge table. When I group by month as follow, it's really slow. and I cannot order by month correctly. select to_char(sub_date, 'MM/YY') as date_ent, to_char(sub_date,'YYMM') as revdate, count(id) as count from subs group by to_char(sub_date,'YYMM'), to_char sub_date,'MM/YY') order by to_char(sub_date,'YYMM') desc Is there any fast way to do this without usnding to_char? Thank you. ------_=_NextPart_001_01C050D0.090954C0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit
I'm having a hard time to group by month.
subs table has id, and sub_date (date type) and it's huge table.
When I group by month as follow, it's really slow. and I cannot order by month correctly.

select to_char(sub_date, 'MM/YY') as date_ent, to_char(sub_date,'YYMM') as revdate, count(id) as count
from subs
group by to_char(sub_date,'YYMM'), to_char sub_date,'MM/YY')
order by to_char(sub_date,'YYMM') desc

Is there any fast way to do this without usnding to_char?

Thank you.