千家信息网

MySQL 多表更新的限制

发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,在对多表进行更新时,不支持ORDER BY、LIMIT。mysql> update Subscribers2 s,tmp_Subscribers_01 t set s.date='2015-01-01
千家信息网最后更新 2025年02月04日MySQL 多表更新的限制在对多表进行更新时,不支持ORDER BY、LIMIT。

mysql> update Subscribers2 s,tmp_Subscribers_01 t set s.date='2015-01-01',
-> s.LastAccessTimeStamp=unix_timestamp(date '2015-01-01')
-> where s.MSISDN=t.MSISDN and t.id between 1 and 5000 limit 2000;
ERROR 1221 (HY000): Incorrect usage of UPDATE and LIMIT

mysql> update Subscribers2 s,tmp_Subscribers_01 t set s.date='2015-01-01',
-> s.LastAccessTimeStamp=unix_timestamp(date '2015-01-01')
-> where s.MSISDN=t.MSISDN and t.id between 1 and 5000 order by s.date;
ERROR 1221 (HY000): Incorrect usage of UPDATE and ORDER BY
0