Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query good in 3.2, but fails in 4.1

Status
Not open for further replies.

CryoGen

MIS
Apr 15, 2004
86
US
We recently upgraded to ColdFusion 7 and MySQL 4.1, and the query below -- which worked fine under CF5 and MySQL 3.2 -- is failing now. Based on the error (below) it looks like a query error, but after going through the 4.1 docs I still can't see the problem. Any ideas why it's failing?

Code:
<cfquery name="GetAssociatedTasks" DATASOURCE="#REQUEST.DataSource#">
SELECT    task_id, report_id, project_cat, task, status, org
FROM      tasks
WHERE     report_id IN (#ValueList(GetReportID.report_id)#)
AND       org LIKE '%Form.org%'
ORDER BY  project_cat
</cfquery>

It throws this error:

Code:
Error Executing Database Query.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND org LIKE '%Form.org%' ORDER BY project_cat' at line 3
 
The error occurred in C:\Inetpub\[URL unfurl="true"]wwwroot\news\report_template.cfm:[/URL] line 21

19 : SELECT    task_id, report_id, project_cat, task, status, org
20 : FROM      tasks
21 : WHERE     report_id IN (#ValueList(GetReportID.report_id)#)
22 : AND       org LIKE '%Form.org%'
23 : ORDER BY  project_cat

SQL        SELECT task_id, report_id, project_cat, task, status, org FROM tasks WHERE report_id IN () AND org LIKE '%Form.org%' ORDER BY project_cat
DATASOURCE       VGGG
VENDORERRORCODE       1064
SQLSTATE       42000
Please try the following:

    * Check the ColdFusion documentation to verify that you are using the correct syntax.
    * Search the Knowledge Base to find a solution to your problem.
 
For some reason, MySQL (4.1 at least) doesn't like empty value lists like "IN ()". You would need to say "IN (null)" instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top