I am running this inside of my cfquery
.
SET @rID = ( SELECT TOP 1 roleid
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);
Is it possible to retrieve @rID
without having to run the SELECT
query a second time?
As in:
<cfset varName = queryName.rID>
The above doesn't work obviously, but is there any other way to return the variable from the query?
You can get the value of @rID
by select
ing it without the need to run the full query again.
<cfquery name="qryRoleID">
SET @rID = ( SELECT TOP 1 roleid
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);
SELECT @rID AS rID
</cfquery>
<cfdump var="#qryRoleID.rID#">
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