SELECT *, (
CASE WHEN ats1.time_slot_id = 48
THEN 1
ELSE ats1.time_slot_id
END
) AS temp_time_slot_id,
(
SELECT id
FROM allocated_time_slot
WHERE from_time >= '2018-10-11 06:25:40'
AND patient_id IS NULL
AND doctor_id = '1167'
AND time_slot_id = temp_time_slot_id
) AS ats2
FROM allocated_time_slot AS ats1
WHERE ats1.doctor_id = '1167'
AND ats1.from_time >= '2018-10-11 06:25:40'
AND ats1.patient_id IS NULL
AND ats2 IS NOT NULL
LIMIT 1
暂无答案!
目前还没有任何答案,快来回答吧!