1

I've got an error to store a new procedure in phpMyAdmin. I am trying to insert this code (with MySQL) as a new procedure:

UPDATE a
SET a.firstname = b.firstname,
    a.lastname  = b.lastname,
    a.sex       = b.sex 
FROM stagingtable b
JOIN tbl_syncList a ON a.idcolumn = b.idcolumn
WHERE b.timestamp > a.timestamp

INSERT tbl_syncList(firstname, lastname, sex, dateOfBirth, email)
SELECT 
    b.firstname,
    b.lastname,
    b.sex,
    b.dateOfBirth,
    b.email
FROM stagingtable b
LEFT JOIN tbl_syncList a ON a.idcolumn = b.idcolumn
WHERE a.idcolumn IS NULL

I am getting this error: #1064, synthax error, check manual for synthax to use near "FROM stagingtable b JOIN tbl_syncList a ON a.idcolumn = b.idcolumn WHERE (etc.)... on line 5

Any ideas what is wrong? Thanks a lot for your help!

James Z
  • 12,209
  • 10
  • 24
  • 44
Trichophyton
  • 625
  • 5
  • 21
  • Possible duplicate of [Update one MySQL table with values from another](http://stackoverflow.com/questions/5727827/update-one-mysql-table-with-values-from-another) – James Z Mar 27 '16 at 18:17

0 Answers0