我目前正在尝试创建一个查询,以便我可以显示哪些患者在特定日期进行了手术,但是我一直遇到这个问题
[Err] 1054 - “字段列表”中的未知列“Patient.PatientSurname”
我要实现的查询是这样的
SELECT Patient.PatientSurname,
Patient.PatientSex,
Patent.PatientAge,
Doctor.DoctorSurname,
Doctor.DoctorSpecialism
FROM Operation
WHERE (Operation.Date = ‘21/12/2010’);
这可能与索引有关吗?
这是我的病人表的代码
CREATE TABLE Patient
(PatientCode VARCHAR (5) NOT NULL,
PatientSurname VARCHAR (15) NOT NULL,
PatientFirstName VARCHAR (15) NOT NULL,
PatientSex VARCHAR (6) NOT NULL,
PatientAge VARCHAR (3) NOT NULL,
PatientOccupation VARCHAR (15) NOT NULL,
PatientHeight VARCHAR (5) NOT NULL,
PatientWeight VARCHAR (6) NOT NULL,
PatientAddress VARCHAR (20) NOT NULL,
PRIMARY KEY (PatientCode),
);
CREATE TABLE Operation
(OperationCode VARCHAR (6) NOT NULL,
PatientCode VARCHAR (5) NOT NULL,
DoctorCode VARCHAR (6) NOT NULL,
Date DATETIME NOT NULL,
Result VARCHAR (10) NOT NULL,
OperationType VARCHAR (15) NOT NULL,
PRIMARY KEY (OperationCode),
FOREIGN KEY (PatientCode) REFERENCES Patient(PatientCode) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (DoctorCode) REFERENCES Doctor(DoctorCode) ON UPDATE CASCADE ON DELETE RESTRICT );