Skip to main content
Participating Frequently
July 29, 2009
Answered

ValueList error

  • July 29, 2009
  • 1 reply
  • 819 views

Hi all,


I am getting an error with this code:

<cfquery name="session.Job_JpActiveResultList" dbtype="query">
SELECT *
from session.job_Sorted
where AnnounceNum IN (#ValueList(qJpPostID.fk_Job_AnnounceNum)#)
</cfquery>

The error states that
"the select column reference [TU_1] is not a column in any of the tables of the FROM table list"

Hard-coded, the query looks like this:
<cfquery name="session.Job_JpActiveResultList" dbtype="query">
SELECT * from session.job_Sorted where AnnounceNum IN (0001,0002,0003,0004,0005,0006,0007,TU_1,0011,0008)
</cfquery>

This same code runs in a different place in my site with no problem, but it's not run as a QofQ in that case.

The field type of "AnnounceNum" and "fk_Job_AnnounceNum" is "varchar".

I've tried single quotes around different portions of e "valuelist" code, but it doesn't help. I get this error:


Invalid CFML construct found on line 23 at column 66.
ColdFusion was looking at the following text:

\'

This is critical to my site. The AnnounceNum is unique and must be varchar.

Any help is appreciated.

This topic has been closed for replies.
Correct answer -__cfSearching__-

If the values are varchar's, they must obviously be quoted. Take a look at the QuotedValueList function, or try <cfqueryparam list="true" ...> (without the quotes).

1 reply

-__cfSearching__-Correct answer
Inspiring
July 29, 2009

If the values are varchar's, they must obviously be quoted. Take a look at the QuotedValueList function, or try <cfqueryparam list="true" ...> (without the quotes).