Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    7

    Unanswered: a

    a
    Last edited by uelwilson; 10-13-03 at 04:52.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1

    Re: after count and min then show more

    Originally posted by uelwilson
    i want to:
    "List the doctor(s) with the least patients and all his patient names."

    i only can :

    select query1.* from
    (select d.name, d.specialty, d.joinyear, count(*) TotalPrescription
    from patient p, doctor d, appointment a
    where p.patientmrn = a.patientmrn and
    d.doctormrn = a.doctormrn
    group by d.name, d.specialty, d.joinyear)query1,
    (select min(query2.Total) as Least
    from (select d.doctormrn, count(*) Total
    from patient p, doctor d, appointment a
    where p.patientmrn = a.patientmrn and
    d.doctormrn = a.doctormrn
    group by d.doctormrn) query2) query3
    where query1.TotalPrescription = query3.Least;

    Above query can only select the Doctor details and the total prescription he/she had prescripted. But i want the patient name also
    Which school, class & instructor is this homework assignment for?
    I suspect that you were not paying attention is class. :-(

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •