Ask a Question related to Coldfusion Database Access, Design and Development.
-
ICI-MASA #1
Order By or sorting nested querys
Hi,
I have this code for example
<cfquery name="rsRights" datasource="cf_db">
SELECT RID, UID, PID FROM tbRights WHERE PID = #URL.PID#
</cfquery>
<cfloop query="rsRights">
<cfquery name="rsUsers" datasource="cf_db">
SELECT UID, UfirstName, UlastName FROM tbUsers WHERE UID =
<cfoutput>#rsRights.UID#</cfoutput>
</cfquery>
<cfoutput>#rsUsers.UfirstName#</cfoutput> <cfoutput>#rsUsers.UlastName#</cf
output>
</cfloop>
Now because it is the rsRights query that I am looping how do make an ORDER BY
for the rsUsers? Because it does not help to put Order By in the rsUsers Query!
or do I have the wrong approch on this?
Regards
Martin
ICI-MASA Guest
-
Sorting a recursive table by specified order
Hi all, I've got an table like this: TABLE: id int(8) PRIMARY AUTO_INCREMENT name varchar(80) parent int(8) INDEX order ... -
Weird sorting order when cflooping complex structures
I use a complex structure like this: <cfset Application.nodeList = StructNew()> <cfset Application.nodeList.item1 = 'Status'> <cfset... -
Sorting the nested HierarGrid by Denis Bauer
Hi, I am using Denis Bauers HierarGrid and would like to sort the nested grid. However each time I do that, I get the error message: Please... -
Sorting by alphabetical order
I am doing a troubleshooting section in a manual and I would like to sort the problems under that section by alphabetical order. What do I do to sort... -
datagrid sorting - Reflection.Assembly.Load - Nested WebControls
Hi, I am using reflection to load strong name custom webcontrols from the GAC. Control names are fed from a database to dynamically render... -
vkunirs #2
Re: Order By or sorting nested querys
Hi
can u try like this:
<cfloop query="rsRights">
<cfquery name="rsUsers" datasource="cf_db">
SELECT UID, UfirstName, UlastName FROM tbUsers WHERE UID =
<cfoutput>#rsRights.UID#</cfoutput> order by UID
</cfquery>
</cfloop>
Is this what you want?
on which field you want to sort and in which table it is.
vkunirs Guest
-
ICI-MASA #3
Re: Order By or sorting nested querys
Hi,
sorry i forgot to say that the field I wanted to sort is UfirstName, and I
tried to place a order by UfirstName where you placed the order by UID but that
doesnt work, because I guess the loop is for the rsRights query or?
regards
Martin
ICI-MASA Guest
-
paross1 #4
Re: Order By or sorting nested querys
Perhaps...
<cfquery name="rsUsers" datasource="cf_db">
SELECT tu.UID, tu.UfirstName, tu.UlastName
FROM tbUsers tu INNER JOIN tbRights tr ON tu.UID = tr.UID
WHERE tr.PID = #URL.PID#
</cfquery>
<cfoutput query="rsUsers">#UfirstName#   UlastName#</cfoutput
paross1 Guest
-
ICI-MASA #5
Re: Order By or sorting nested querys
Thanks Paross,
that was the way to go...
regards
Martin
ICI-MASA Guest



Reply With Quote

