Skip to main content
1 de 2
Vicent
  • 1.5k
  • 6
  • 12

Puedes utilizar la consulta que has realizado para, a partir de ella, obtener la suma:


SELECT tbl.Total + tbl.Dol AS t_total
FROM
    (SELECT 
      cproveedores.estado,
      SUM(cproveedores.total) AS Total
    FROM
      cproveedores
    WHERE
      cproveedores.estado = 'pendiente'

    UNION ALL

    SELECT 
      fact_dolar.estado,
      SUM(fact_dolar.importe_total) AS Dol
    FROM
      fact_dolar
    WHERE
      fact_dolar.estado = 'pendiente'
    GROUP BY
      fact_dolar.estado) AS tbl

Vicent
  • 1.5k
  • 6
  • 12