Is it possible to use union all
in rails? I'm putting together a query but I need to use union all
, is there any way to adapt it to rails? Here's my query:
select sum(DV.Importe + DV.iva)
from venta INNER JOIN DetalleVet DV ON DV.RutaId = [venta].RutaID AND DV.IdEmpresa = [venta].IdEmpresa AND DV.Docto = [venta].Documento
where venta.Rutaid=8 and diao=611 and venta.TipoVta='Contado'
union all
select SUM(DP.Importe + DP.Iva) from pedidosliberados PL inner join detallepedidoliberado DP on PL.PEDIDO=DP.PEDIDO and PL.RUTA=DP.RUTA and PL.IDEMPRESA=DP.idempresa
where PL.cancelada=0 and PL.status=5 and PL.Tipo='Contado' and PL.Ruta=8 and PL.DiaO_entrega=611