i try to update my table in databse Using INNER join, but it keep showing error I'm Using MYQSL 5.5 here is my code in mapper
UPDATE room_availability INNER JOIN room_availability ON list_hotel.hotel_id = room_availability.hotel_id
INNER JOIN room_price ON room_availability.hotel_id = room_price.hotel_id SET ${Room_type}_room = #{kamarBaru},room_date = #{booking_date}
WHERE list_hotel.nama_hotel = #{hotel_name};
here is the error
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: Not unique table/alias: 'room_availability'
### The error may involve Hotel.insertUpdateRoom-Inline
### The error occurred while setting parameters
### SQL: UPDATE room_availability INNER JOIN room_availability ON list_hotel.hotel_id = room_availability.hotel_id INNER JOIN room_price ON room_availability.hotel_id = room_price.hotel_id SET deluxe_room = ?,room_date = ? WHERE list_hotel.nama_hotel = ?;
### Cause: java.sql.SQLSyntaxErrorException: Not unique table/alias: 'room_availability'] with root cause
java.sql.SQLSyntaxErrorException: Not unique table/alias: 'room_availability'
And here is my database Design in SQLYog
can someone tell me where did i do wrong here?
this might work:
UPDATE room_availability
SET ${Room_type}_room = #{kamarBaru},room_date = #{booking_date}
FROM room_availability
INNER JOIN list_hotel ON list_hotel.hotel_id = room_availability.hotel_id
INNER JOIN room_price ON room_availability.hotel_id = room_price.hotel_id
WHERE list_hotel.nama_hotel = #{hotel_name};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.