I need help writing an SQL Query which would get me the results as I want.
I have a document upload feature, in which a document can be upload for clients on multiple locations. The table structure is simple, there are just 5 columns; FileID, FileName, Title, Description and LocationID. If a user uploads a document for 3 locations, 3 entries are entered in to this table. Lets say
FileID FileName Title Description LocationID 1 File1 File1 Description 1 100 2 File1 File1 Description 1 21 4 File1 File1 Description 1 181
A user uploads another file for 4 locations, the data gets entered and the table now looks like this
FileID FileName Title Description LocationID 1 File1.doc File1 Description 1 100 2 File1.doc File1 Description 1 21 4 File1.doc File1 Description 1 181 5 File2.pdf File2 Description 2 123 6 File2.pdf File2 Description 2 12 7 File2.pdf File2 Description 2 126 8 File2.pdf File2 Description 2 100
Now what i want in the result is
FileName Title Description LocationCSV File1.doc File1 Description 1 100, 21, 181 File2.pdf File2 Description 2 123, 12, 126, 100