Mysql 需要帮助使用join方法和concat方法连接sql中的三个表吗

Mysql 需要帮助使用join方法和concat方法连接sql中的三个表吗,mysql,sql,join,concat,Mysql,Sql,Join,Concat,下面有三个表,其中最后一个表由前两个表中的两列组成: 五: 我已经用where子句完成了问题,但不能用join方法完成。 在这里,我使用where子句: SELECT appointmentdate,doctorname,concat(name,' ',family) AS patientname from appointment,doctor,patients WHERE doctor.doctor_id=appointment.doctor_id AND appointment.p

下面有三个表,其中最后一个表由前两个表中的两列组成:

五:

我已经用where子句完成了问题,但不能用join方法完成。 在这里,我使用where子句:

SELECT appointmentdate,doctorname,concat(name,' ',family) AS patientname 
from appointment,doctor,patients 
WHERE doctor.doctor_id=appointment.doctor_id 
AND appointment.patient_id=patients.patient_id;

多糟糕的问题啊。你还没有努力解决这个问题,至少花点精力发布一个合适的问题。我确实使用where条件完成了问题,但无法使用join方法完成。显示你尝试了什么以及出现了什么问题。因此,在你的回答中,d p参考表名预约,医生和患者正确(抱歉,刚刚开始学习sql)这些是表名的别名。如果我们不得不在每一列前面写下整个表名,比如
appointment.appointmentdate
SELECT a.appointmentdate,
  d.doctorname,
  p.patientname
FROM appointment a
JOIN doctors d
ON a.doctor_id = d.doctor_id
JOIN patients p
ON a.patient_id = p.patient_id;