Les Irvin wrote:
> 
> http://redwood.jmdl.com/themes.cfm
> http://redwood.jmdl.com/themes_code.cfm (code)

I'd say this is a perfect example of why you don't want to have 
repeating data in a field, and why you would want to move that theme 
data out into a separate table that relates photos to theme...then you 
could re-write the query and code something like this...

<CFQUERY NAME="getData" DATASOURCE="#DB_redwood#">
SELECT a.theme,d.lname,d.fname, count(c.artist_id) as 
photocount,c.artist_id,a.theme_id
FROM themes a LEFT JOIN photothemes b ON a.theme_id = b.theme_id
LEFT JOIN photos c ON b.photo_id = c.photo_id
LEFT JOIN photographers d ON c.artist_id = d.id
GROUP BY a.theme,d.lname,d.fname,c.artist_id
ORDER BY theme,lname,fname
</cfquery>

<table width="750" border="0">
<cfset n=1>
<cfoutput query="getData" group="theme">
<cfif n IS 1><tr></cfif>
     <td valign="top" id="a4"><span class="ttitle">#theme#</span><br>
        <cfoutput><span class="click"><a 
href="photos.cfm?id=#artist_id#&theme=#theme_id#&f=#fname#&l=#lname#">#fname# 
#lname#</a> (#photocount#)<br></span></cfoutput>
        </td>
<cfif n IS 4></tr><cfset n=1><cfelse><cfset n=n+1></cfif>
</cfoutput>
<cfif n GT 1>
<cfloop index="i" from="#n#" to="4"><td>&nbsp;</td></cfloop>
</tr>
</cfif>
</table>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267859
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to