Take the following query example:
<cfquery name="Test" Datasource = "TestDB">
    Select * from Table_Test
</cfquery>
Assume that the "Test" query returns 10 rows. I want to show single row on current time.
Note: I do not want to change the SQL statement.
If you know your row number, Test.columnName[RowNumber] will show you the value of the columnName in specified row number. 
If you want one random row from the query:
    <cfset start = randRange(1, Test.recordCount)>
    <cfoutput>
        #Test.name[start]# #Test.email[start]#<br>
    </cfoutput>
No need to loop.
NOTE: It is more efficient to modify the query to get a random row.
How to request a random row in SQL?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With