select tipomov, tipovalor, valor from plamovpro where estado='A'; select tipomov, sum(monto) from plaprovemp where periodo=220 and planilla='02' and estado='A' group by tipomov; select count(distinct empleado) emps, sum(monto) from pladevenemp where periodo=220 and planilla='02' and estado='A'; select tipomov, sum(monto) from plaprovemp where periodo=220 and planilla='02' and estado='A' and empleado='8066321' group by tipomov; select count(distinct empleado) emps, sum(monto) from pladevenemp where periodo=220 and planilla='02' and empleado='8066321' and estado='A'; select tipomov, ccosto, numpago, monto from plaprovemp where periodo=220 and planilla='02' and estado='A' and tipomov='148' and empleado='8066321'; select tipomov, ccosto, numpago, monto from pladevenemp where periodo=220 and planilla='02' and estado='A' and empleado='8066321'; Las deduciones por clase (No hay de tipo PRO) SQL> select clase, count(*) from plamovded group by clase; CLA COUNT(*) --- --------- ASO 2 REN 4 PRE 11 DED 46 Las provisiones Activas SQL> select tipomov, tipovalor, valor 2 from plamovpro 3 where estado='A'; TIP T VALOR --- - --------- 102 P 5 145 P 4.16 148 P 8.333 149 P 23 151 P 1.22 127 M 100 102 P 5 145 P 4.16 148 P 8.333 149 P 23 151 P 1.22 No hay provisiones por empleado SQL> select count(*) from plamovproemp; COUNT(*) --------- 0 Las provisiones acumuladas del periodo 220 la planilla 02 SQL> select tipomov, sum(monto) 2 from plaprovemp 3 where periodo=220 4 and planilla='02' 5 group by tipomov; TIP SUM(MONTO) --- ---------- 127 45699.8 151 1060426.5 102 1154556.7 148 7243057.4 149 19991639 145 3615879.1 El total de devengados y de empleados SQL> select count(distinct empleado) emps, sum(monto) 2 from pladevenemp 3 where periodo=220 4 and planilla='02' 5 and estado='A'; EMPS SUM(MONTO) --------- ---------- 160 28363480 Las provisiones de un empleado (todos estan parecido) SQL> select tipomov, sum(monto) 2 from plaprovemp 3 where periodo=220 4 and planilla='02' 5 and estado='A' 6 and empleado='8066321' 7 group by tipomov; TIP SUM(MONTO) --- ---------- 127 749.99 102 15395.86 151 21577.8 148 147383.41 149 406794.37 145 73576.84 Los devengados de ese empleado SQL> select count(distinct empleado) emps, sum(monto) 2 from pladevenemp 3 where periodo=220 4 and planilla='02' 5 and empleado='8066321' 6 and estado='A'; EMPS SUM(MONTO) --------- ---------- 1 307916.75 La provision 148 SQL> select tipomov, ccosto, numpago, monto 2 from plaprovemp 3 where periodo=220 4 and planilla='02' 5 and estado='A' 6 and tipomov='148' 7 and empleado='8066321'; TIP CCOSTO NUMPAGO MONTO --- ------- --------- --------- 148 0110 11140 6880.88 148 0101 11159 475.33 148 0105 11159 404.22 148 0106 11159 37.05 148 0110 11159 138448.86 148 0118 11159 1052.97 148 0119 11159 22.53 148 0120 11159 61.57 8 filas seleccionadas. El detalle de los devengados SQL> select tipomov, ccosto, numpago, monto 2 from pladevenemp 3 where periodo=220 4 and planilla='02' 5 and estado='A' 6 and empleado='8066321'; TIP CCOSTO NUMPAGO MONTO --- ------- --------- --------- 002 0110 11140 25567.8 003 0110 11140 136.65 001 0110 11140 56869.36 130 0101 11159 422.52 130 0105 11159 421.8 130 0106 11159 46.8 130 0110 11159 221240.22 130 0118 11159 2630.36 130 0119 11159 90.14 130 0120 11159 491.1 10 filas seleccionadas.