Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    137

    Unanswered: MySQL - Update a table from same table using SELECT

    Hi,

    I am trying to update the customers MySQL table using SELECT from the same table but getting:

    [Err] 1064 - 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 '(destination_table.title) =

    here is the SQL statement:

    UPDATE customers destination_table

    SET (destination_table.title) =
    (

    SELECT source_table.title

    FROM customers source_table

    WHERE source_table.customer_id = 18

    )

    WHERE destination_table.customer_id = 14;



    Thanks,
    Jassim

  2. #2
    Join Date
    Jul 2016
    Posts
    2
    Hi, just looking quickly, I don't think you need the brackets here:
    SET (destination_table.title) =
    Try it without:
    SET destination_table.title =

Posting Permissions

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