我目前正在試圖建立一個查詢,以便我可以顯示該患者的具體日期了一次手術,但我不斷收到這個問題查詢MySQL中未知列
[錯誤] 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);
你似乎忘記加入表。 –
你有「病人」和「醫生」的桌子嗎?你想讓它加入'Operation'? –
是的,我有他們的表,我需要重新做我的代碼才能加入他們? – user1977206