Results 1 to 2 of 2

Thread: Problem in Update with select

  1. #1
    Join Date
    Sep 2010
    Posts
    188

    Problem in Update with select

    Hi
    Have this update query:

    Code:
    UPDATE kanban_data kd SET (wip_chemicalweighing, wip_compounding, wip_extrusion, wip_forming, wip_deflashing) = (SELECT ROUND(IF (NOT ISNULL(SUM(compounding)), 0, SUM(chemicalweighing)),2) AS wip_chemicalweighing, ROUND(IF (NOT ISNULL(SUM(extrusion)), 0, SUM(compounding)),2) AS wip_compounding, ROUND(IF (NOT ISNULL(SUM(forming)), 0, SUM(extrusion)),2) AS wip_extrusion', 'ROUND(SUM(deflashing),2) AS wip_deflashing FROM kanban k WHERE k.LOT_CODE = kd.LOT_CODE AND k.REFNUM = kd.REFNUM GROUP BY k.REFNUM);
    and I got this error:

    Error Code : 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 '(wip_chemicalweighing, wip_compounding, wip_extrusion, wip_forming, wip_deflashi' at line 1
    (16 ms taken)

    Thank you

  2. #2
    Join Date
    Mar 2012
    Posts
    93
    first of all you are used select statement after that you are used update query.. recheck in mysql.. may you write the wrong table name and also wrong field name.

Similar Threads

  1. Problem in WHERE Clause from SELECT Statement
    By newphpbees in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 13 Dec 2011, 07:27 PM
  2. problem with indexes is SELECT query
    By Alx in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 22 May 2008, 12:15 AM

Posting Permissions

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