Hi!
I'm experiencing query problems! My Procedure table looks like this:
And the ProcedureList table looks like:
I want to list registred records for a specific patient by passing a SQL query to the database that returns:
for patient number 1532.
Another example for patient number 723:
And the last one (number 792):
I can't seem to crack the nested select and case subquery... any tips and pointers would be very welcome!
graabein
I'm experiencing query problems! My Procedure table looks like this:
Code:
ID | Patient | Date | Procedures | SaveDate
130 | 1532 | 2002-11-20 | 1; | 2004-09-20
131 | 723 | 2002-11-20 | | 2004-09-20
132 | 792 | 2002-11-04 | 3;17; | 2004-09-20
And the ProcedureList table looks like:
Code:
ID | Name | Active
1 | Day care | 1
2 | Lobotomy | 0
3 | Surgery | 1
17 | Consultation | 1
I want to list registred records for a specific patient by passing a SQL query to the database that returns:
Code:
ID | Date | ProcedureNames | SaveDate
130 | 2002-11-20 | Day care | 2004-09-20
Another example for patient number 723:
Code:
ID | Date | ProcedureNames | SaveDate
131 | 2002-11-20 | | 2004-09-20
And the last one (number 792):
Code:
ID | Date | ProcedureNames | SaveDate
132 | 2002-11-04 | Surgery, consultation | 2004-09-20
I can't seem to crack the nested select and case subquery... any tips and pointers would be very welcome!
graabein