1

表:

Patient (PatientID, FamilyName, GivenName, Address, Suburb, State, PostCode) 
Doctor (ProviderNo, Name)
Item (ItemNo, Description, Fee)
Account (AccountNo, ProviderNo, PatientID, Date)
AccountLine (AccountNo, ItemNo)

Qns:接受过 Brian 医生治疗或接受过延长咨询的患者姓名

我的回答:

select p.GivenName ||''|| p.FamilyName as Name
   FROM DTOOHEY.Account A, DTOOHEY.Patient P, Dtoohey.Doctor D, Dtoohey.Item I, Dtoohey.AccountLine AL
WHERE P.PATIENTID = A.PATIENTID
AND A.PROVIDERNO = D.PROVIDERNO
AND I.ITEMNO = AL.ITEMNO
WHERE D.NAME = 'Dr Brian' or I.Description = 'Extended Consultation';
MyError: WHERE D.NAME = 'Dr Brian' or I.Description = 'Extended Consultation'
* ERROR at line 6: ORA-00933: SQL command not properly ended

我哪里做错了???

4

1 回答 1

1

您已经有一个WHERE子句,因此重复的子句会导致错误。如果要添加条件,请使用布尔运算符

AND (D.NAME = 'Dr Brian' OR I.Description = 'Extended Consultation')
于 2013-10-21T02:38:30.313 回答