mysql - Query to update and delete records in two different tables -


i want write query deletes record table , updates record in anther one. query:

delete borrowed_books a.id = '$id'               ,              update books b set b.nr_copies=b.nr_copies+1  b.id_book=a.id_book  

the error in console says: you have error in sql syntax; check manual corresponds mariadb server version

i using mysql , xampp.

you can't 2 action in query

you must use 2 query

delete borrowed_books a.id = '$id'  ;   update books b  inner join borrowed_books  set b.nr_copies=b.nr_copies+1  b.id_book=a.id_book  , a.id = '$id'  ; 

using update join

eventually can check mysql driver multiple query in command


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -