Hi All, How would I turn this into an SQL while loop rather than a nested query? I never used while loops and can't quite suss it.
Here's the code: <!--- Select the priority of this service ---> <cfquery name="getAllServices" datasource="#REQUEST.theDatabase#"> SELECT priority, serviceID FROM TPSservices WHERE active = '1' AND priority > <cfqueryparam value="#getDeletedPrior.priority#" cfsqltype="cf_sql_integer" /> </cfquery> <!--- Loop over the services ---> <cfloop query="getAllServices"> <cfset newPriority = #priority# - 1> <cfquery name="getAllServices" datasource="#REQUEST.theDatabase#"> FROM TPSservices SET priority = <cfqueryparam value="#newPriority#" cfsqltype="cf_sql_integer" /> WHERE serviceID = <cfqueryparam value="#serviceID#" cfsqltype="cf_sql_integer" /> </cfquery> </cfloop> Thanks in advance. Richard ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258363 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

