sql查询到dql

zwghvu4y  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(172)

我有一个很大的查询,我想添加一个子查询,以获得住宿房间的可用性。
这是sql子查询:

,(SELECT (CASE WHEN count(_days) > 0 THEN 'yes' ELSE 'No' END) as available
FROM
(
  SELECT count(rtd.room_type_id) as _days
    FROM room_type_day as rtd
    WHERE rtd.date IN ('2018-06-20', '2018-06-21', '2018-06-22')
    GROUP BY rtd.room_type_id
    HAVING COUNT(rtd.room_type_id) = 3
) as sub) as availability

有人能告诉我如何在dql中转换这个sql吗?
谢谢你
编辑
我尝试进行此更改,但每次响应都为空:

,(SELECT (CASE WHEN count(rtd.roomType) > 0 THEN 'yes' ELSE 'no' END)
    FROM AppBundle:RoomTypeDayCancelationConditionAccommodation as RTDCCA2
    LEFT JOIN RTDCCA2.roomTypeDay as rtd
    WHERE rtd.date IN ('2018-06-20', '2018-06-21', '2018-06-22')
    GROUP BY rtd.roomType
    HAVING COUNT(rtd.roomType) = 3
) as disponible

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题