我正在尝试使用“ON DUPLICATE KEY UPDATE”语句运行基于 SELECT 的 INSERT 查询。SELECT 查询有效,如果我“手动”输入结果数据将导致重复键问题。到目前为止,一切都很好。但是,下面的查询似乎没有像我预期的那样更新“et_report_ymd.quotes”中的值。
INSERT IGNORE INTO et_report_ymd
SELECT
NULL,
t.year AS year,
t.month AS month,
t.day AS day,
SUM(t.quotes) AS quotes
FROM source_table AS t
GROUP BY t.year, t.month, t.day
ON DUPLICATE KEY UPDATE
et_report_ymd.quotes = quotes
欢迎所有帮助...