I am assuming your form.features is a list of IDs ? SELECT property_id from property_details WHERE (pkBuildingID IN (1, 2, 3))
Code would be SELECT property_id from property_details WHERE (pkBuildingID IN (#form.features#)) Is a lot easier and works many times faster.. -----Original Message----- From: Pragnesh [mailto:[EMAIL PROTECTED] Sent: Wednesday, 25 June 2003 11:15 AM To: CFAussie Mailing List Subject: [cfaussie] Re: Cant work out SQL Query error. Still doesnt work. Am generating the where clause dynamically featurestr=""; for (i = 1; i LTE listlen(form.features); i = i+1) { fid=ListGetAt(form.features,i,","); featurestr=featurestr & "property_features = '" & fid & "'"; featurestr=featurestr & " OR property_features LIKE '%," & fid & "'"; featurestr=featurestr & " OR property_features LIKE '" & fid & ",%'"; featurestr=featurestr & " OR property_features LIKE '%," & fid & ",%'"; Am getting this as the output: property_features = '1' OR property_features LIKE '%,1' OR property_features LIKE '1,%' OR property_features LIKE '%,1,%' OR property_features = '2' OR property_features LIKE '%,2' OR property_features LIKE '2,%' OR property_features LIKE '%,2,%' When I use it in a query, it throws an error <cfquery name="getsearchresult1" datasource="#config.datasource#"> SELECT property_id from property_details where #featurestr# </cfquery> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Single quotes instead of double, but also: Change OR property_features LIKE "2" To: OR property_features = '2' Steve c -----Original Message----- From: Pragnesh [mailto:[EMAIL PROTECTED] Sent: Wednesday, 25 June 2003 10:52 AM To: CFAussie Mailing List Subject: [cfaussie] Cant work out SQL Query error. HI All, Cannot work out why the sql query is throwing an error. Worst thing is when I execute the query in MS ACCESS it runs but thro CF it throws this error. Any suggestions would be appreciated. Error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 8. Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly. SQL Query is: SELECT property_id from property_details where property_features LIKE "1" OR property_features LIKE "%,1" OR property_features LIKE "1,%" OR property_features LIKE "%,1,%" OR property_features LIKE "2" OR property_features LIKE "%,2" OR property_features LIKE "2,%" OR property_features LIKE "%,2,%" --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ ---------------------------------------------------------------------------- This email, together with any attachments, is intended for the named recipient(s) only and may contain privileged and confidential information. If received in error, please inform the sender as quickly as possible and delete this email and any copies from your computer system network. If not an intended recipient of this email, you must not copy, distribute or rely upon it and any form of disclosure, modification, distribution and/or publication of this email is prohibited. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ---------------------------------------------------------------------------- --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
