Guest Chromewell Posted April 22, 2007 Share Posted April 22, 2007 I have two tables, "Doctor(name, specialization)" and "Patient(name, illness, treatment)". - Each name represents one single person; - A doctor may be a patient;- Also, illness and specialization are the same thing, that means, headache may appear in both tables;- A doctor may be specialized in more than one area;- An illness may have many different kinds of treatment.I want to SELECT the names of the doctors who have all the illnesses in which they are specialized.Please help! Link to comment Share on other sites More sharing options...
Yahweh Posted April 23, 2007 Share Posted April 23, 2007 I have two tables, "Doctor(name, specialization)" and "Patient(name, illness, treatment)". - Each name represents one single person; - A doctor may be a patient;- Also, illness and specialization are the same thing, that means, headache may appear in both tables;- A doctor may be specialized in more than one area;- An illness may have many different kinds of treatment.I want to SELECT the names of the doctors who have all the illnesses in which they are specialized.Please help! SELECT d.nameFROM Doctor dLEFT JOIN Patient p ON (d.name = p.name)WHERE d.specialization = p.illness Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now