1
這個查詢應該給我取消的約會(post_appt_status_id = 3)並且沒有重新預訂。Mysql查詢:哪裏沒有
SELECT appointments.id, concat_ws(' ', contacts.first_name, contacts.last_name) AS contact_name, contacts.id, appointments.start AS appt_date
FROM
appointments appts2
LEFT JOIN contacts ON contacts.id = appointments.contact_id
WHERE marketing_event_id ='740' AND appointments.company_id = '1'
AND appointments.post_appt_status_id = '3'
AND contacts.id NOT IN (SELECT contact_id FROM appointments WHERE appointments.start > appt_date)
GROUP BY contacts.id
問題在於子選擇。我無法傳入appt_date值以使其正常工作。我收到一個錯誤,它是一個未知的列。
完成,非常感謝您抽出寶貴時間。 –