If you are using SQL Server, here is one solution I came up with:

<cfquery datasource="for_testing" name="Events">
SELECT
EntryInfo,
DATENAME(mm,EntryDate) + ' ' + CAST(DATEPART(d,EntryDate) AS varchar(2)) AS
DisplayDate,
EntryDate

FROM
DateGroup

ORDER BY
EntryDate
</cfquery>

<cfoutput query="Events" group="DisplayDate">
#DisplayDate#<br>
================<br>
<cfoutput>#EntryInfo#<br></cfoutput>
<br><br>
</cfoutput>

I created a test table called DateGroup with two fields:
EntryInfo varchar(20)
EntryDate smalldatetime (4)

The other solution wasn't taking into account that your dates had times
associated with them, so when the output was being grouped, a new group was
created for each event because each date/time value was unique!  I like this
solution because it allows the database to do the work, which is where I
feel it should be done in many situations.

You shouldn't have too much of a problem adapting the code to work with
RDBMSs other than SQL Server, I don't think.

Andy

-----Original Message-----
From: Jake . [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 03, 2004 12:00 PM
To: CF-Talk
Subject: Re: Grouping help

Thanks, I appreciate the help. Looks like part of my problem is (as always)
the fact that I'm using dates. Does this method work with dates?

>I have a tutorial on grouping in CF here:
>http://tutorial150.easycfm.com/
>
>Hope that helps :)
>
>Charlie
>
>
>>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to