MySQL 多表更新的限制

feelpurple發表於2016-08-04
在對多表進行更新時,不支援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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2123001/,如需轉載,請註明出處,否則將追究法律責任。

相關文章