Helpful Information
 
 
Category: ColdFusion
Help! Coldfusion error

I'm trying to update 2 tables in one database. My first query is going through alright. The second one has some bugs.

My code is:

insert into panel_scene_map (scene_id, panel_id)
SELECT MAX(panel_id) AS new_id FROM panel
values('#scene_id#', '#panel_id#')


This is my error message:
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.


I have double checked the values I'm passing and they are correct. I think it has something to do with the SELECT MAX function. Thanks for the advice!!!

I'm trying to update 2 tables in one database. My first query is going through alright. The second one has some bugs.

My code is:

insert into panel_scene_map (scene_id, panel_id)
SELECT MAX(panel_id) AS new_id FROM panel
values('#scene_id#', '#panel_id#')


This is my error message:
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.


I have double checked the values I'm passing and they are correct. I think it has something to do with the SELECT MAX function. Thanks for the advice!!!

Your query is not correct.
You are mixing two queries here


1. insert into panel_scene_map (scene_id, panel_id)
values('#scene_id#', '#panel_id#')

2. SELECT MAX(panel_id) AS new_id FROM panel_scene_map

So, after executed the first query, use another <cfquery> to execute the second one...










privacy (GDPR)