Hi Will, if you add an ORDER BY to your query on the field(s) you want to
group on it will usually take care of this problem.

-Justin 

> -----Original Message-----
> From: Will Tomlinson [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, November 20, 2005 12:44 PM
> To: CF-Talk
> Subject: Grouping problems
> 
> I always have a hard time grouping my queries and usually 
> resort to the group attribute in cfoutput. Once again, it's 
> not showing me what I need. I think it'd be best to group in 
> the SQL before I even output it but don't know exactly how to 
> do it without making things worse. 
> 
> What I need to do is show the combined product options with 
> their prices in a select, ordered the way I want. What I've 
> currently got *works*, but it isn't ordered properly.
> You can see it here: 
> http://wtomlinson.com/newcart/productdetail.cfm?PID=114  
> 
> Here's my query:
> 
> <cfquery name="getproductoptions" datasource="#VARIABLES.DSN#">
> SELECT tblSKUS.SKUID, tblSKUS.merchSKUID, tblSKUS.SKU_prodID, 
> tblSKUS.SKUprice,tblSKUoptions_rel.optionID, 
> tblSKUoptions_rel.optionSKUID,
> tblSKUoptions_rel.option_optionID, tblSKUoptions.SKUoptionID, 
> tblSKUoptions.SKUoptionname, tblSKUoptions.SKUoptionsort
> FROM  tblSKUS, tblSKUoptions_rel, tblSKUoptions
> WHERE tblSKUS.SKU_prodID = #ARGUMENTS.PRODID#
> AND tblSKUS.SKUID = tblSKUoptions_rel.optionSKUID
> AND tblSKUoptions_rel.option_optionID = tblSKUoptions.SKUoptionID
> </cfquery>
> 
> Here's the output:
> 
> <cfif getproductoptions.recordcount NEQ 0>
>       select option(s):
> <cfselect name="optionID">
>            <cfoutput query="getProductOptions" group="optionSKUID">
>            <option 
> value="#SKUID#"><cfoutput>#SKUoptionname#&nbsp;</cfoutput> 
> #DollarFormat(SKUprice)#</option>
>            </cfoutput>
>         </cfselect>
> Thanks,
> Will
> 
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224755
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to