0
我寫了下面的查詢,在那裏我更新兩個表,但在三個不同的查詢聯合查詢作爲一個查詢優化
與查詢條件這樣做如下:
檢查從表中的空座位這是針對「USER_ID」和更新「USER_ID」來設置
UPDATE seats SET user_id = '101', modified = NOW() WHERE book_id ='123' AND user_id = '0' LIMIT 1
一旦seat
設定更新book
表用於更新時間針對book id
UPDATE books SET end_time = '$end_time', modified = NOW() WHERE id ='123';
再次更新seats
表更新registered
列1,在seat
表相同book_id
UPDATE seats SET registered = '1', modified = NOW() WHERE book_id ='123';
我可以寫他們作爲一個優化的查詢?