MySQL Forums
Forum List  »  InnoDB

How to update two tables but limit one row?
Posted by: nobody nobody
Date: February 09, 2019 05:36PM

Apparently the mysql does not allow update multiple tables to use order limit, but I need the update only be limited to a single row, how could I do it?

mysql> update t1, t2 set t1.lastContact = 1549706102, t2.timestamp = 1549706102, t2.data = 9 where t1.id = t2.parentId and t1.id = 378 and t2.timestamp > 1549706000 order by t1.id desc limit 1;
ERROR 1221 (HY000): Incorrect usage of UPDATE and ORDER BY

Thank you.

Options: ReplyQuote


Subject
Views
Written By
Posted
How to update two tables but limit one row?
1068
February 09, 2019 05:36PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.