SQL查询联接不工作

SQL查询联接不工作,sql,join,Sql,Join,我有三张桌子。tooth、toothchart和tblpaient 以下是列名称 tooth-Tid,toothName toothchart-patientId,stage, TeethCode,note tblpatient-patientId,fname 我想从“tooth”表和“teethchart”表中获取给定患者值的所有值,但我的查询没有给出tooth表的所有值 这是我的问题 SELECT tooth.*,teethchart.*,fname FROM tooth LEFT J

我有三张桌子。
tooth、toothchart和tblpaient
以下是
名称

tooth-Tid,toothName
toothchart-patientId,stage, TeethCode,note
tblpatient-patientId,fname
我想从“
tooth
”表和“
teethchart
”表中获取给定患者值的所有值,但我的查询没有给出
tooth
表的所有值

这是我的问题

SELECT tooth.*,teethchart.*,fname 
FROM tooth 
LEFT JOIN teethchart ON tooth.toothName = teethchart.TeethCode 
left join tblpatient on teethchart.patientId=tblpatient.patientId 
where teethchart.patientId = 'P0001'

有人能帮我解决这个问题吗?

下面的查询将从齿形图中提取所有项目,并且仅从齿形图和TBL患者中提取匹配的项目

SELECT t.*, p.fname, tc.*
From tooth t
left join teethchart tc on t.toothName = tc.TeethCode
left join tblpatient p on tc.patientId = p.patientId
and p.patientId = 'P0001';