House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Query output - based on date range

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Ahhh,
coldfusion.developer
03/20/07 01:34 P
coldfusion.developer@att.net wrote:
Jim Wright
03/20/07 02:01 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
coldfusion.developer
03/20/2007 01:34 PM

Ahhh, I have an events database that lists the details of an event and the date range of number days the event runs.  If it's a one day event, eventdate is the same as eventdate2. I've got the events outputting over a calendar so all the events show a single listing of each event.  I want to display the event in each day within the date range within a calendar. Should I be using cfloop instead? Any ideas would be so helpful. Thanks. OUTPUT CODE <cfoutput query="Events">          <tr>              <td class="date_cell">#LSDateFormat(Events.EVENTDATE,'MMM')# <strong>#LSDateFormat(Events.EVENTDATE,'DD')#</strong></td>              <td class="name_loc_cell">#Events.EVENTNAME#</td>              <td class="name_loc_cell">#Events.EVENTLOCATION#</td>              <td>#Events.EVENTDESCR#</td>             </tr>        </cfoutput>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jim Wright
03/20/2007 02:01 PM

coldfusion.developer@att.net wrote: ----- Excess quoted text cut - see Original Post for more ----- For things like this, sometimes it can be good to have a utility table that lists the dates that you need to view...so just have a table something like... tblDates thisdate datetime populate that with every day from some way back date to some way forward date...then it makes it very easy to join against your events table and find all events within a date range and have them assigned to the correct date(s)... SELECT a.thisdate,b.eventname,b.eventlocation,b.eventdescr FROM tblDates a LEFT JOIN Events b ON a.thisdate >= b.eventdate AND a.thisdate <= b.eventdate2 WHERE (limit tblDates by some date range) ORDER BY a.thisdate,b.eventname Then you can just use cfoutput and group to output a calendar of events that shows all of the days in the range... <cfoutput query="Events" group="thisdate"> <h1>#thisdate#</h1> <ul> <cfoutput> <li>#eventname#<BR>#eventlocation#<BR>#eventdescr# </cfoutput> </ul> </cfoutput>


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference