UPDATE counter_reports
SET `counter`=`counter`+1,`date`=?
WHERE report_id IN(
(SELECT report_id
FROM counter_reports
WHERE report_name="emails_sent" AND `year`=1
ORDER BY report_id DESC LIMIT 1),
(SELECT report_id
FROM counter_reports
WHERE report_name="emails_sent" AND `month`=1
ORDER BY report_id DESC LIMIT 1),
(SELECT report_id
FROM counter_reports
WHERE report_name="emails_sent" AND `week`=1
ORDER BY report_id DESC LIMIT 1),
(SELECT report_id
FROM counter_reports
WHERE report_name="emails_sent" AND `day`=1
ORDER BY report_id DESC LIMIT 1)
)
是否有任何替代這種SQL?我需要更新(增加1)最後的櫃檯報告日,周,月和年。有關更新的Mysql問題
如果我手動添加,SQL工作正常,但對子查詢無法啓動。
謝謝。 :)
有什麼錯誤? – Hao 2010-05-18 14:27:47