Need help with a SQL query error: probably me being stupid

Hello All,

      I apologize in advance if this is really dumb; but coldfusion is giving me an error when i try to run the following delete query:

                              DELETE FROM FWjobs
                        WHERE title IN ''
                        AND subcatText IN '#form.subcategories#'
                        AND catID IN '#form.categories#'
All the error says is incorrect syntax.  The stack trace shows the statement was evaluated at runtime as the following:

                               DELETE FROM FWjobs
                               WHERE title IN 'Delivery Person,Packer Person'
                               AND subcatText IN 'Delivery,Shipper'
                               AND catID IN '2,3'

Which looks correct to me; am I doing something stupid?

Thank you.
Who is Participating?
ziolkoConnect With a Mentor Commented:
should look like this:
WHERE title IN ('Delivery Person','Packer Person')
AND subcatText IN ('Delivery','Shipper')
AND catID IN (2,3)

andrewaielloAuthor Commented:
so the parentheses are missing.... those lists are coming in from the forms multiple selection list can i change that?
andrewaielloAuthor Commented:
and also; the error only flagged on the last line of that query; if the parenthesis where the error..wouldn't the previous lines have been flagged?
error is only on last line (AND catID IN '2,3') because catId is of type int while '2,3' is treated as string.
theres no error in: AND subcatText IN 'Delivery,Shipper' because subcatText and 'Delivery,Shipper' are same type, but in this form 'Delivery, Shipper' will be treated as set containing just one string that is: 'Delivery,Shipper' and ('Delivery', 'Shipper') is set containg two strings

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.