【发布时间】:2017-10-27 14:47:51
【问题描述】:
这是我的数据库架构:
我只是想选择一个病人的所有约会并得到以下结果集:
我已经尝试过以下加入:
SELECT [User].user_id,name, surname, [Appointment].day,[Appointment].month,[Appointment].year,[Appointment].hour,[Appointment].minutes
FROM [User]
LEFT JOIN [Doctor] ON [Doctor].user_id = [User].user_id
LEFT JOIN [Patient] ON [Patient].user_id = [User].user_id
LEFT JOIN [Appointment] ON [Doctor].doctor_id = [Appointment].doctor_id and [Patient].patient_id = [Appointment].patient_id
但是我没有得到想要的输出!
【问题讨论】:
标签: sql sql-server database select join