PASS COLUMN CONSULTATION RESULTS

0

Good morning,

I have the following query

select e.documento,e.NOMBRE1||' '||TRIM(e.NOMBRE2)||' '||e.APELLIDO1||' '||e.APELLIDO2 "NOMBRE",l.concepto,l.valor


FROM empleado e,vinculacion v,detallevinculacion vd,liquidacion l


WHERE e.CODEMPLEADO = '555222' AND e.CODEMPLEADO = v.CODEMPLEADO AND v.NUMVINCULACION = vd.NUMVINCULACION AND  vd.TIPOREG = 2 AND v.CODVINCULACIONESTADO = 1 AND vd.NUMVINCULACION = l.NUMVINCULACION AND l.CODNOMINA = '01/30/2017'

the result is:

NUMDOCUMENTO ;NOMBRE ;CODCONCEPTO ;VALOR
555222 ;PEDRO PEREZ;SUBASICO ;1491589
555222 ;PEDRO PEREZ;PRORT ;1
555222 ;PEDRO PEREZ;DIASS ;30
555222 ;PEDRO PEREZ;DIASR ;30
555222 ;PEDRO PEREZ;DIASL ;30
555222 ;PEDRO PEREZ;DIDOT ;30
555222 ;PEDRO PEREZ;IBINC ;1491589
555222 ;PEDRO PEREZ;PROBS ;62150
333666 ;JUAN PARDO;SUBASICO ;1491589
333666 ;JUAN PARDO;PRORT ;1
333666 ;JUAN PARDO;DIASS ;30
333666 ;JUAN PARDO;DIASR ;30
333666 ;JUAN PARDO;DIASL ;30
333666 ;JUAN PARDO;DIDOT ;30
333666 ;JUAN PARDO;IBINC ;1491589
333666 ;JUAN PARDO;PROBS ;62150

What I need is to show the concept results as columns and below the value, that is to say:

NUMDOCUMENTO ;NOMBRE ;SUBASICO PRORT; DIASS; DIASR
555222 ;PEDRO PEREZ ;1491589 ;30 ;30 ;30
333666 ;JUAN PARDO ;1491589 ;30 ;30 ;30

is about a liquidation and the liquidation concepts are many let's say 100, and it will be done on all the employees ie when you remove the condition e.CODEMPLEADO = '555222' it will be on all employees.

I saw some examples with PIVOT but for a number of fixed columns.

Thank you very much for your attention.

    
asked by DIANGA 21.06.2017 в 18:39
source

0 answers