A few months ago, our supplier added the possibility of our ticketing system, which allows you to add any number of custom fields to your ticket. I would like to request these fields along with other call information for reporting purposes, but each expandable field is stored as a row in the database. So basically you have something like this:
ext_doc_no call_record value 1 1001 Test 2 1001 test2 3 1001 moretest
I would like to request back:
1001 Test test2 moretest
I tried using PIVOT, but it pretty much required things like using an aggregate function. Any other ideas on how to do this?
EDIT: I also tried to query each row separately in the main query and use the function ... but both methods are too slow. I need something to immediately get all the lines, PIVOT and then join the main request.
source share