0
Gentlemen, good morning !
I am trying to make a simple parcel PIVOT under same customer number (330162210001), however I am not getting...
The idea is that each plot result found is a column.
We have tried various sql Aggregation Function, but to no avail.
You’re making this mistake :
We have tried to convert all possible type types so that it can read. But without success.
Type of Table we are working on:
Result of Subquery:
Code used:
SELECT * FROM (
SELECT dup.cliente, dup.VR_LIQ_ATU,dup.NUMERO, DUP.VALOR
FROM DUPLICATAS_ABERTAS DUP WHERE dup.CLIENTE = 330162210001) as Q
PIVOT(
MAX (cliente)
FOR VR_LIQ_ATU IN ([VALOR_C]))AS PVT
If anyone can shed some light, we appreciate the understanding.
What would be this "VALOR_C"? I have not seen it present/declared in SQL. Another question is, if you have 1,000 rows, will it turn those 1,000 rows into 1,000 columns? Or there is a limit of returns per customer, for example, will have a maximum of 12 installments.
– Pedro Costa
pedro o valor_c is just the column that he has to return the plot data. In this table there are up to 3 installments. So I don’t have to worry about that, you know? rs
– Maguim
in fact the PIVOT, at least in SQL Server does not work like this, the field that is there in the IN is the identifier of the pivot column. I’ll put it in answer so you understand better.
– Pedro Costa