本文主要是介绍mysql中从select结果中update,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
mysql貌似没法直接使用update table set a=x from select
但是可以使用inner join来实现:
update librarys INNER JOIN (select * from librarys where hallCode=’AHRF’ OR hallCode=’AGZE’) aa set librarys.system_source=3 where aa.id=librarys.id
UPDATE library_borrower_books INNER JOIN library_books ON library_borrower_books.libraryBookId=library_books.id SET library_borrower_books.limit_borrow_days=50 WHERE library_borrower_books.idCard=’510725198802055137’ and library_books.tag=’e00401503a8ef1e5’
这篇关于mysql中从select结果中update的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!