Coldfusion Query ORDER BY syntax
Hi,
I have products stored in different categories and I want to run a query that will display the products either by product name or by product price depending on the category ID. I have it working with just one category being sorted by product name (as below) but how do I specify for multiple categories e.g. IF #URL.cat# EQ "10" OR "11" OR "5" OR "14" ???
<cfif #URL.cat# EQ "10">
<cfquery name="catalogue" datasource="#request.SiteDSN#" username="#request.DSNUser#" password="#request.DSNPasswd#">
SELECT *
FROM products
WHERE prod_cat_id = <cfqueryPARAM value = "#URL.cat#"
CFSQLType = "CF_SQL_INTEGER"> ORDER BY prod_name
</cfquery><cfelse>
<cfquery name="catalogue" datasource="#request.SiteDSN#" username="#request.DSNUser#" password="#request.DSNPasswd#">
SELECT *
FROM products
WHERE prod_cat_id = <cfqueryPARAM value = "#URL.cat#"
CFSQLType = "CF_SQL_INTEGER"> ORDER BY prod_price
</cfquery>
</cfif>
Thanks in advance!
