I need to learn how to GROUP in my db's. I'm sick of using the group attribute 
in a <cfoutput>. It always seems to make things harder for me! 

Ok, I have products, each product has SKUS. I run my query on the products and 
SKUS. So far so good. How do I group the dang thing in the SQL? 

This doesn't work:

SELECT  tblProducts.prodname, tblProducts.prodshortdescription, 
tblProducts.prodID, tblProducts.prodshowonweb, tblSKUS.SKU_prodID, 
tblSKUS.SKUprice, tblSKUS.SKUsaleprice, tblProductCategories_rel.catID_rel, 
tblProductCategories_rel.catID, tblProductCategories_rel.ProdID, 
tblImages_rel.prodID,  tblImages_rel.imagetypeID, 
tblImages_rel.prodimagefilename
FROM (tblProducts 
LEFT OUTER JOIN tblImages_rel ON tblProducts.prodID = tblImages_rel.prodID)
INNER JOIN tblProductCategories_rel ON tblProducts.prodID = 
tblProductCategories_rel.ProdID
INNER JOIN tblSKUS ON tblProducts.prodID = tblSKUS.SKU_prodID
WHERE tblProductCategories_rel.catID = <cfqueryparam cfsqltype="cf_sql_integer" 
value="#ARGUMENTS.CID#">
AND prodshowonweb = <cfqueryparam cfsqltype="cf_sql_integer" value="1">
GROUP BY tblProducts.prodID
ORDER BY tblProducts.prodname

I get this error:

'tblProducts.prodname' is invalid in the select list because it is not 
contained in either an aggregate function or the GROUP BY clause.

How can I group this by the product ID?

Thanks much,
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:226356
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