select count(hno) from 患者
LEFT JOIN 医生 ON 患者.yno=医生.Yno
LEFT JOIN 科室 ON 医生.Ydept=科室.Dno
where 医生.hname="杨振宇" and 科室.Dname="眼科" and 患者.Date=curdate()
看起来逻辑没问题,是对的
select COUNT(hno) from 患者 where 患者.Yno =
(select Yno from 医生,科室
where Yname = '杨振宇' and 医生.Ydept = Dno and Dname = '眼科')
and DATE_FORMAT(Date, '%Y-%m-%d') = curdate();