Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select * from op_anticipo_emp op
- inner join documento d on d.id=op.op_id
- left join (select sum(doc.importe_moneda_base) suma, rg.op_anticipo_emp_id from RG_GASTO_EMPLEADO rg inner join documento doc on doc.id=rg.op_id group by rg.op_anticipo_emp_id) kk on kk.op_anticipo_emp_id=d.id
- where d.duenio='dsalguero' and (d.importe_moneda_base>kk.suma or kk.suma is null)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement