Кто-нибудь может мне помочь с этим утверждением? Я пытаюсь получить количество бус в объекте с вместимостью комнаты * количество
SELECT
object.id, object.name,
location.address,
location.postcode,
location_city.`name`,
(
select
case
when object_room.object_room_type_id = 1 then (1 * object_room.quantity)
when object_room.object_room_type_id = 2 then (2 * object_room.quantity)
when object_room.object_room_type_id = 3 then (3 * object_room.quantity)
when object_room.object_room_type_id = 4 then (5 * object_room.quantity)
when object_room.object_room_type_id = 5 then (1 * object_room.quantity)
when object_room.object_room_type_id = 6 then (4 * object_room.quantity)
when object_room.object_room_type_id = 8 then (2 * object_room.quantity)
when object_room.object_room_type_id = 9 then (3 * object_room.quantity)
end CASE
from object_room
)
FROM object
LEFT JOIN location ON object.location_id = location.id
LEFT JOIN location_city ON location.location_city_id = location_city.id
LEFT JOIN object_room ON object.id = object_room.object_id
Я получил эту ошибку:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE
from object_room