Jump to content

SELECT problem


Guest Chromewell

Recommended Posts

Guest Chromewell

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...