I'm receiving the following error and can not figure out why:
Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ')'. The error occurred on line 141.
<cfquery datasource="mySource" name="getTravel">
select traveler, customernumber, destination, tripdate, purpose, empid, pm_reportid, company
from mySource.dbo.PM_Travel
where pm_reportid in
(
<cfloop from="1" to="#getRecentReports.recordcount#" index="i">
<cfif i lt getRecentReports.recordcount>
#getRecentReports.pm_reportid[i]#,
<cfelse>
#getRecentReports.pm_reportid[i]#
</cfif>
</cfloop>
)
order by customernumber
</cfquery>
Line 141 is:
where pm_reportid in (<cfloop from="1" to="#getRecentReports.recordcount#" index="i"><cfif i lt getRecentReports.recordcount>#getRecentReports.pm_reportid[i]#, <cfelse>#getRecentReports.pm_reportid[i]#</cfif></cfloop>)
This was not written by me, and I'm new to CF. Any help is appreciated.
WHERE Col IN ( {nothing here} )or missing id'sWHERE Col (11,22,33,{no value here},44). - LeighgetRecentReports? It is possible you could simplify the query by using aJOINinstead of acfloop. - Leigh