3
Hello, I’m having a hard time turning rows into columns on SQL Server
.
I haven’t been able to write anything yet... I thought about PIVOT
, but since it’s not always the same amount of columns, I’m not getting to think about how to do...
I have these 2 tables:
Expected result:
It’s for a report that.
How about a Function or sub-consumption?
– Marconi
@Marconi, how would you do it? My biggest problem is being in, I do not have a set amount of columns, ie in this example I did with 4 defects, but I can have more as far as I can have less
– LeoHenrique
As if I had an accountant who showed me the item that has more defect and this would be my limit for that report, following then, I would have the other items with their respective defects. That is, if the item with the largest amount of defects is 5, then I will have 5 columns of defects and so, the other defects of each item, would be distributed in these 5 columns
– LeoHenrique