I have 2 tables, one called and another client, I need to return how many calls the client had in the current month, last month and last month, I tried using union, it returned me normally, but I can only do a count. p>
SELECT
COUNT(*) AS total_chamado,
from chamado, cliente
where
chamado.id_cliente = cliente.id AND
GROUP BY chamado.id_cliente
union
(
SELECT
COUNT(*) AS total_chamado_passado,
from chamado, cliente
where
chamado.id_cliente = cliente.id AND
chamado.data_atendimento BETWEEN CURDATE() - INTERVAL 1 month AND CURDATE()
GROUP BY chamado.id_cliente
)