You don't need to store only month in the DB, you need to store (and order
by) a complete date field, but only display the month name on the web page.

something like...

<cfquery name="q1" ....
SELECT eventdate, dates, event
   FROM events
  ORDER BY eventdate
 </cfquery>

<cfset oldmonth="">
<cfoutput query = ....>
 <cfif oldmonth neq "#dateFormat(q1.eventdate,'mmmm')#">
    <cfset oldmonth="#dateFormat(q1.eventdate,'mmmm')#">
    #dateFormat(q1.eventdate,'mmmm')#
    #q1.dates# #q1.event#.
<cfoutput>



----- Original Message -----
From: "Jeff Fongemie" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, April 29, 2001 6:25 PM
Subject: Access field Month Only?


> Hello cf-talk,
>
>   I have a list of events I want to show on a web page. Each event is
>   listed as month, days and name of event.
>
>   Is there a way to have a field for month only?? I can only figure
>   out complete dates.
>
>   I'd love to have a query like:
>
>   GET month, dates, event
>   FROM events
>   SORT BY month, dates
>
>   But, months needs to be sorted not just by name, as in a text field,
>   it needs to be sorted cronologically.
>
>   Needs to look like:
>
>   APRIL     22-26 Ricky and his stupid band
>             28-30 Carla and her bad voice
>
>   MAY       2-4   Zippy and the ZipRockets
>             10-12 Dummy and the Dummets
>
>
> And so on. I started just adding the events as individual records. But
> don't want Ricky and his stupid voice showing up 4 times. Also, It
> would be better for client to add just one record for Ricky and all of
> his dates.
>
> Am I approaching this from the right angle?? Missing an obviously
> better way to do this??
>
>
> Best regards,
>  Jeff Fongemie                          mailto:[EMAIL PROTECTED]
> ------------------------
> Internet Guns For Hire
> (603) 356-0768
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to