3
How do I add the values of the three selects below:
(
SELECT
(valor1 + valor2 + valor3) AS total SELECT
SUM(valor) AS valor1
FROM
pagamentos
WHERE
pagamentos.cliente = '1'
AND contratosid = '9289'
AND excluir != '1'
UNION ALL
SELECT
SUM(valor) AS valor2
FROM
pagcielo
WHERE
pagcielo.confirmado = '1'
AND contratosid = '9289'
AND excluir != '1'
UNION ALL
SELECT
SUM(valor) AS valor3
FROM
pagboleto
WHERE
pagboleto. STATUS = '1'
AND contratosid = '9289'
AND excluir != '1'
)