| View previous topic :: View next topic |
| Author |
Message |
Silver79 Fresher
Joined: 02 Dec 2006 Posts: 11 Location: Detroit, MI
|
Posted: Sun Dec 03, 2006 10:39 pm Post subject: Listing items by one column's attributes |
|
|
I have a database that categorizes events by year, title of event, venue, and city/state (that is to say, these are the columns in the table). I have inputted past events and plan to create an admin area so that future events can be added.
I want to these events on the user's side by year without having to repeat the year after every list item.
For example:
2005
* title of event - venue - city/state
* title of event - venue - city/state
2004
* etc...
How can I do this? |
|
| Back to top |
|
 |
cindy Member
Joined: 02 Dec 2006 Posts: 22
|
Posted: Sun Dec 03, 2006 10:40 pm Post subject: |
|
|
Try this:
Code:
<cfoutput>
<h3>#year#</h3>
<cfoutput>
- #title# #venue# #city/state#
</cfoutput>
</cfoutput>
If you use the GROUP= attribute of CFOUTPUT, then the query must have an ORDER BY where the first column is the same column used in the GROUP= parameter for grouping the results
If not, you'll get results like:
2005
* some data
* some data
2004
* some data
2006
* some data
* some data
* some data
2005
some data |
|
| Back to top |
|
 |
|