R3
2008-05-09 16:33:17 UTC
I have created the following DB table: -
CREATE TABLE Patient (
patient_id NUMBER(10) NOT NULL PRIMARY KEY,
Patient_name VARCHAR(30) NOT NULL,
address VARCHAR(150) NOT NULL,
phone VARCHAR(25) NOT NULL,
date_of_birth DATE NOT NULL ,
blood_group VARCHAR(2) NOT NULL,
medCon_id NUMBER(10) NOT NULL,
FOREIGN KEY (medCon_id) REFERENCES Medical_Conditions(medCon_id));
I'm trying to run the following query
SELECT
p.NAME AS Patient_name,
p.blood_group AS blood_group
FROM
Patient p,
GP doc,
visit v,
Medical_Conditions cond
WHERE
p.patient_id = v.patient_id
AND doc.Gp_id = v.Gp_id
AND p.medCon_id = cond.medCon_id
AND cond.condition = 'High Blood Pressure'
AND doc.NAME = 'DR S Smith'
ORDER BY
p.NAME ASC,
p.blood_group DESC
I continually get presented with the following error:
p.Name ASC,
*
ERROR at line 16:
ORA-00904: "P"."NAME": invalid identifier
I'm a beginner with SQL any help will be greatly appreciated.
Thanks In Advance