the error says (ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name 'profilesid'.
if i leave (ORDER BY #Variables.OrderBy# #Variables.Direction#) out of the query it works fine but then cannot sort the records descending or ascending.
<!--- here is my code--->
<cfif isDefined('URL.StartRow') OR isDefined('Form.StartRow')>
<cfif isDefined('URL.StartRow')>
<cfset StartRow=URL.StartRow>
<cfelse>
<cfset StartRow=Form.StartRow>
</cfif>
<cfelse>
<cfset StartRow=1>
</cfif>
<cfif isDefined('URL.OrderBy') OR isDefined('Form.OrderBy')>
<cfif isDefined('URL.OrderBy')>
<cfset OrderBy=URL.OrderBy>
<cfelse>
<cfset OrderBy=Form.OrderBy>
</cfif>
<cfelse>
<cfset OrderBy="profilesid">
</cfif>
<cfif isDefined('URL.Direction') OR isDefined('Form.Direction')>
<cfif isDefined('URL.Direction')>
<cfset Direction=URL.Direction>
<cfelse>
<cfset Direction=Form.Direction>
</cfif>
<cfelse>
<cfset Direction="ASC">
</cfif>
<CFQUERY name="GetRecords" dataSource="limited" >
SELECT *, profiles.photo AS photo
FROM request_form INNER JOIN
profiles ON request_form.profilesid = profiles.profilesid
WHERE action_status='Requested'
ORDER BY #Variables.OrderBy# #Variables.Direction#
</CFQUERY>
<!---END--->
Please do not post the same question in different forums:
Scott F Stroz
Frontal Grey Technologies
------------------------------------
I would rather have a bottle in front of me, than a frontal lobotomy.
Referring URLs
http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=3&threadid=732190