Hi guys,

Got a product query (see below) - just want to make sure that not more
than one of each product_id is displayed on a page. Tried the GROUP BY
function

Eg. GROUP BY products.product_id

But I get the error...

[Macromedia][SQLServer JDBC Driver][SQLServer]Column
'products.product_price' is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause.

This error occurs for all columns not included in the group by. How can
I achieve this?

Thanks
mike

<cfquery name="getProducts">
        SELECT products.product_id, products.product_price,
products.product_image_small, products.product_status,
products.product_display, products_description.product_title,
products_to_category.order_key, products_to_category.category_id,
collection.collection_title, collection.collection_image,
collection.collection_image_map
        FROM products 
        INNER JOIN products_description ON products.product_id =
products_description.product_id 
        INNER JOIN products_to_category ON products.product_id =
products_to_category.product_id
        INNER JOIN products_to_collection ON products.product_id =
products_to_collection.product_id
        INNER JOIN collection ON products_to_collection.collection_id =
collection.collection_id
        WHERE products.product_status = 1 
        AND products.product_display = 1 
        <cfif len(URL.category_id)>
                AND products_to_category.category_id = <cfqueryparam
cfsqltype="cf_sql_integer" value="#URL.category_id#">
        </cfif>
        <cfif len(URL.s_category_id)>
                AND products_to_category.category_id = <cfqueryparam
cfsqltype="cf_sql_integer" value="#URL.s_category_id#">
        </cfif>
        <cfif len(URL.collection_id)>
                AND products_to_collection.collection_id = <cfqueryparam
cfsqltype="cf_sql_integer" value="#URL.collection_id#">
        </cfif>
        ORDER BY collection.order_key, products_to_collection.order_key
        </cfquery>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:269474
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to