-1

This is my query

UPDATE ludo_purchase_detailed_history 
SET fto_date = logs_20221002.fto_date 
FROM logs_20221002 
WHERE ludo_purchase_detailed_history.uid= logs_20221002.uid;

This is the error I am getting

ERROR 1064 (42000): 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 logs_20221002 WHERE ludo_purchase_detailed_history.uid= logs_20221002.uid' at line 1

Please help me. If anyone know what I am doing wrong here.

Akina
  • 39,301
  • 5
  • 14
  • 25
Sahil
  • 23
  • 1
  • 5
  • 3
    In MySQL there is no FROM clause in UPDATE syntax. Read the Reference Manual, "Multiple-table UPDATE syntax" carefully. – Akina Oct 06 '22 at 06:32
  • you require an update with a join!! – Nikhil S Oct 06 '22 at 06:39
  • @nikhilsugandh I take refrence from this https://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match I want to update a table column using another table – Sahil Oct 06 '22 at 06:42

1 Answers1

1

MySQL has a different syntax than MSSQL

UPDATE ludo_purchase_detailed_history h
JOIN logs_20221002 l ON h.uid = l.uid
SET h.fto_date = l.fto_date 
juergen d
  • 201,996
  • 37
  • 293
  • 362