TheBugSlayer
Programmer
Hi guys,
Worked all week-end and have very little gas left in the tank. I need help with a query. Here is the problem:
I have a
Case(CaseID, CaseNumber, VisitID,...),
Visit(VisitID, PatientID,...), and a
Patient(PatientID, ...) tables.
Given a list of cases (I concatenated them into a string in C# and I am using the string in the IN clause of my queries), I need to retrieve the "history" of the Patients associated with the Cases in the list. There is a 1-to-many relationship between between Patient and Visit as you can see. The history is all visits by the same patient, excluding the Visit generated by the Case in the list (I can remove this myself later). Any help to this tired brain is appreciated.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
Worked all week-end and have very little gas left in the tank. I need help with a query. Here is the problem:
I have a
Case(CaseID, CaseNumber, VisitID,...),
Visit(VisitID, PatientID,...), and a
Patient(PatientID, ...) tables.
Given a list of cases (I concatenated them into a string in C# and I am using the string in the IN clause of my queries), I need to retrieve the "history" of the Patients associated with the Cases in the list. There is a 1-to-many relationship between between Patient and Visit as you can see. The history is all visits by the same patient, excluding the Visit generated by the Case in the list (I can remove this myself later). Any help to this tired brain is appreciated.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)