-2

I am updating a table column from same table field. But i am getting one error.

  UPDATE t 
     SET t.date = t2.date 
    FROM date_table t 
    JOIN date_table t2 
      ON t.id = t2.id 
   WHERE t2.status = 'completed' 
     AND t2.id = 969

i am getting one error

#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 'FROM cdp_lti_topic_details t JOIN cdp_lti_topic_details t2 ON t.id = t2.' at line 3

Dharman
  • 30,962
  • 25
  • 85
  • 135
deepu sankar
  • 4,335
  • 3
  • 26
  • 37

1 Answers1

1

Here's an example of a syntactically correct query...

 UPDATE date_table t 
   JOIN date_table t2 
     ON t.id = t2.id 
    SET t.date = t2.date 
  WHERE t2.status = 'completed' 
    AND t2.id = 969
Strawberry
  • 33,750
  • 13
  • 40
  • 57