Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!!!

  • #2
    New Coder
    Join Date
    Sep 2007
    Location
    India
    Posts
    72
    Thanks
    1
    Thanked 2 Times in 2 Posts
    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

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •