Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Many to many query but needs to be one to many query

Status
Not open for further replies.

CrakD

Technical User
Jul 18, 2003
10
US
as it is right now....i run the census query and it gives me this:
Field 1 Field 2
PATIENT THERAPIST
Blow, Joe Smith, Angel
Blow, Joe Holmes, Sherlock

I really need it to be like this:
Field 1 Field 2 Field 3
PATIENT THERAPIST THERAPIST
Blow, Joe Smith, Angel ; Holmes Sherlock

It's coming from a joined table of therapist, patient
but although it's not a big deal, I would like to be able to use the get external data function in excel, but it's got the fields all mixed up when the query is queried. I'd appreciate any input on this thanks.
 
Are you sure your model is correct? Normally you would expect a patient to see many therapists and a therapist to see many patients so the underlying model is many-to-many. Trying to display them as Patient, Therapist, Therapist is more tricky because you don't know how many therapists you are going to have for each patient. In SQL you can build a table like this by running a query n times where n is the maximum number of therapists per patient.

 
Well..here's the thing...it is a many to many. I do have it set up correctly. The problem comes into play when I want to run reports, using excel, since it's preferred by the boss. and I get this kind of thing

Patient name Therapist
Blow, joe Joe, nobody
jane, mary palms, harry
jane, mary joe, nobody

I'd like to just run a query and have it display the info for the patient in as many columns it takes but in a single row.

patient_name therapist therapist2 therapist3 therapist4
Blow, joe Joe, nobody
jane, mary Palms, harry Nobody, joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top