Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-23-2007, 03:52 PM   PM User | #1
danwillig
New to the CF scene

 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
danwillig is an unknown quantity at this point
Question 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!!!
danwillig is offline   Reply With Quote
Old 12-24-2007, 08:15 AM   PM User | #2
nissar
New Coder

 
Join Date: Sep 2007
Location: India
Posts: 72
Thanks: 1
Thanked 2 Times in 2 Posts
nissar is an unknown quantity at this point
Quote:
Originally Posted by danwillig View Post
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

Quote:
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...
__________________
- Developer from India

Firefox 2.0
nissar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:46 PM.


Advertisement
Log in to turn off these ads.