Gracias
cmunozp por la aclaración
gokufast, las consultas por separado te dan resultado? Tu version de MySQL es?
Código:
SELECT
ufv.voluntario.vol_cod,
SUM(ifnull(ufv.voluntario.vol_depus, 0) - ifnull(ufv.voluntario.vol_retus, 0)) AS saldo_ufv,
FROM
ufv.voluntario,
GROUP BY
ufv.voluntario.vol_cod AND
HAVING
saldo_ufv >= 2796
Código:
SELECT
saldos.voluntario.vol_cod,
SUM(ifnull(saldos.voluntario.vol_depus, 0) - ifnull(saldos.voluntario.vol_retus, 0)) AS saldo_us
FROM
saldos.voluntario
GROUP BY
saldos.voluntario.vol_cod
HAVING
saldo_us >= 500
No seran excluyentes?
Código:
saldo_ufv >= 2796 and saldo_us >= 500
Definiendo el JOIN?
Código:
SELECT
ufv.voluntario.vol_cod,
SUM(ifnull(ufv.voluntario.vol_depus, 0) - ifnull(ufv.voluntario.vol_retus, 0)) AS saldo_ufv,
SUM(ifnull(saldos.voluntario.vol_depus, 0) - ifnull(saldos.voluntario.vol_retus, 0)) AS saldo_us
FROM
ufv.voluntario INNER JOIN saldos.voluntario
ON ufv.voluntario.vol_cod = saldos.voluntario.vol_cod
GROUP BY
ufv.voluntario.vol_cod, <--- no AND
saldos.voluntario.vol_cod
HAVING
saldo_ufv >= 2796 AND
saldo_us >= 500
El JOIN debe ser INNER, LEFT, RIGHT....?
Son las preguntas que me haria yo...
Quim