You don't want to loop over a query (CFQUERY result set) but access the Nth row or the last row.
You can access a query row by adding its number to the query.column variable.
You can access a query row by adding its number to the query.column variable:
To get the column "firstname" in the 2nd row use:
queryName.firstName[2]
To get the column "firstname" in the last row use:
queryName.firstName[queryName.recordCount]
To get the column "firstname" in the Nth row use:
queryName.firstName[N]
+