Just add the year to your group...

select datepart('y',entryDate) as xYear,
datepart('m',entryDate) as eMonth,
count(*) as xcount
from entries where entrystatus = 1
group by datepart('y',entryDate),
datepart('m',entryDate)

...

though your database may also have year() and month() as separate
functions... which might be easier than using datepart...

hth

s. isaac dealey                214-823-9345

team macromedia volunteer      http://www.macromedia.com/go/team

chief architect, tapestry cms  http://products.turnkey.to

onTap is open source           http://www.turnkey.to/ontap

> Hi there, I'm trying to create a list of dates like this:

> Jan 03 (19 records)

> Feb 03 (34 records)

> March 04 (2 records)

> Right now, I'm using this query:

> <CFQUERY name="findDates2"
> datasource="#ATTRIBUTES.datasource#">

>             SELECT DatePart('m', entryDate) as xMonth,
>             count(*) as
> xcount

>             FROM entries

>             WHERE entryStatus = 1

>             GROUP BY DatePart('m', entryDate)

> </CFQUERY>

> And it works like a champ. for one year. Of course, the
> Jan 03 and Jan
> 04 records will get lumped in the same group.bad.

> Any ideas on how to make this work?

> Thanks!
> Jake


>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to