Do not use on any
shared computer
September 6, 2008 03:15pm pdt
 
[x]
Attachment Details

Using 'IN' operator in ColdFusion Query of Queries throwing error

Tags: ColdFusion, SQL, Comparison exception while executing IN.
Having a problem using an 'IN' clause while querying a query in coldfusion 8.  here is the original query:

      <cfquery name="allcrafts" datasource="#APPLICATION.DSN#">
      select e.craft_ID, e.LAST_NAME, e.FIRST_NAME, e.EMP_NUM, e.ADDRESS1, e.CITY, e.PROVINCE, e.ZIP, e.PHONE, e.PHONE2, e.EMAIL, e.DATE_RECIEVED, e.DATE_ENTERED, e.BIRTH_DATE, e.DATE_HIRED, e.DATE_TERM, e.C_ID, e.RESUME, e.EXTENSION, c.CRAFT_DESC
from tbl_craft_employees e, tbl_crafts c
where (e.C_ID = c.craft_ID)
AND date_entered BETWEEN #CreateODBCDate(DateAdd("d", APPLICATION.datenow, -184))# AND #CreateODBCDate(APPLICATION.datenow)#
order by last_name
</cfquery>

Here is the query of the above query:

      <cfquery dbtype="query" name="crafts">
      select craft_ID, last_name, first_name, emp_num, address1, city, province, zip, phone, phone2, email, date_recieved, date_entered, c_ID
      FROM allcrafts
      WHERE #URL.cID# IN ('allcrafts.c_ID')
      order by last_name
      </cfquery>

And I get this error

Query Of Queries runtime error.  
Comparison exception while executing IN.
Unsupported Type Comparison Exception: The IN operator does not support comparison between the following types:
Left hand side expression type = "LONG".
Right hand side expression type = "STRING".

I have tried wrapping the #URL.cID# in '#URL.cID#' in an attempt to change it from a LONG datatype to a STRING.  When I do so, I get this error:

Query Of Queries syntax error.
Encountered "1900 \'\'. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition, Unrecognized comparison operator,


Any help is greatly appreciated.  Thanks.
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: WCD_Support
Solution Provided By: ee_rlee
Participating Experts: 3
Solution Grade: B
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by ee_rlee

Rank: Master

Expert Comment by ee_rlee:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by ee_rlee

Rank: Master

Accepted Solution by ee_rlee:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by zadoc

Rank: Master

Expert Comment by zadoc:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by zadoc

Rank: Master

Expert Comment by zadoc:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by SidFishes

Rank: Sage

Expert Comment by SidFishes:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by ee_rlee

Rank: Master

Expert Comment by ee_rlee:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by ee_rlee

Rank: Master

Expert Comment by ee_rlee:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by ee_rlee

Rank: Master

Expert Comment by ee_rlee:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by WCD_Support
Author Comment by WCD_Support:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628