SELECT a.apnt_no,
p.pt_name,
p.pt_no,
a.mcdp_cd,
d.dr_name,
apnt_ymd
FROM appointment a
JOIN patient p
ON a.pt_no = p.pt_no
JOIN doctor d
ON a.mddr_id = d.dr_id
WHERE DATE_FORMAT(apnt_ymd, "%Y%m%d") = 20220413
AND apnt_cncl_yn = "N"
AND a.mcdp_cd = "CS"
ORDER BY apnt_ymd