Hi, kind of simple question I need help with... I'm a bit inexperienced with some parts of SQL so...
I have a query that looks like this (simplified):
This returns patients with their check-up dates and what procedures was used on the check-up. But I want to collect each patient in one row, not for example three rows for some patients and one for others. I want to cramp the operations in one large string cell besides the patient name and the check-up date.
Example:
Pretty straight forward task I'm sure, but I don't know how and the online tutorials I've seen are to no help. My employer doesn't have SQL books either, so any help would be much welcome!
graabein
I have a query that looks like this (simplified):
Code:
select a.Name, b.Date, c.Operations
from a inner join b on a.PatientID=b.PatientID
left outer join c on b.ID=c.ID
where year(b.Date) > 2003 order by a.PatientID
This returns patients with their check-up dates and what procedures was used on the check-up. But I want to collect each patient in one row, not for example three rows for some patients and one for others. I want to cramp the operations in one large string cell besides the patient name and the check-up date.
Example:
Code:
Name | Date | Operations
Jimi Hendrix | 2004-01-12 00:00:00 | NULL
Townes Van Zandt | 2004-02-26 00:00:00 | 6
Neil Young | 2004-01-20 00:00:00 | 1
Neil Young | 2004-01-20 00:00:00 | 2
Pretty straight forward task I'm sure, but I don't know how and the online tutorials I've seen are to no help. My employer doesn't have SQL books either, so any help would be much welcome!
graabein