嘿傢伙我想知道如果任何人都可以發現我的SQL語句中的任何錯誤。我希望它能在我的表格中插入一條新的記錄,如果其中一條不存在的話。如果它確實存在,那就更新它。我在日期字段中的主鍵。MySQL在重複密鑰更新語法錯誤
這裏是我的發言,因爲它出現在PHP,也是錯誤我得到:
INSERT INTO ExtraStats (date, supportStaff, startEmails, endEmails, emailsAnswered) VALUES ('$startDate', '$supportStaff', '$startEmail', '$endEmail', '$emailAnswered') ON DUPLICATE KEY UPDATE (supportStaff, startEmails, endEmails, emailsAnswered) VALUES ('$supportStaff', '$startEmail', '$endEmail', '$emailAnswered')
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 '(supportStaff, startEmails, endEmails, emailsAnswered) VALUES ('2', '3', '1', '3' at line 1
你先生是個天才! 太棒了! 謝謝! –