I have a table like this:
IliskiId KulId DptId DosyaAdi
------------------------------------
2 332 66 4-92
3 332 66 9-50
4 332 73 13-96
5 332 73 15-19
6 334 71 10-11
7 334 72 35-14
I need a query which would return this particular example just like in this form:
KulId DptId DosyaAdi
---------------------------------
332 66 4-92, 9-50
332 73 13-96, 15-19
334 71 10-11
334 72 35-14
What is going on here is that I grouped the same DptId values in the same row and appended DosyaAdi values on top of the first one...there can be more than two cases as well, like 10 different DosyaAdi values for the same particular DptId.
I tried many ways but always got that "Subquery returned more than 1 value" error. I know that I need to use STUFF in order to group all DosyaAdi values in the same cell in that form though(separated with ","). I google'd a lot as well but couldn't find anything since this is a very specific problem.
Help really appreciated... I need a query for this result so bad.