Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-02-02 : 11:56:32
|
Steve writes "I have tried to find a solution to this problem with no success, though I am aware that there may be a well known answer.
Anyway here goes. I work in a large hospital department where we use a SQL server 7.0 to manage patient data. All the patient demographics are in a patient table with a patient identifier as a primary key. All of the diseases that given patients have are stored in a patients diseases table with the patient identifier as a foreign key. Clearly any given patient can have >= 0 diseases (some may have three or four listed)
My problem is that I want to write a query which for each patient gives the result :-
Patient A has disease 1, disease 2,... Patient B has disease 2, disease 6,... Patient C has no disease . . . etc
My best attempt at the moment will repeat the patient data on a seperate line for each disease the patient has in the disease table. If it makes it any easier the query could be written in Access 97.
I would be exceptionally grateful for any assistance you could provide.
Thanks
SE" |
|
|
|
|
|