我正在尝试获取总量为零(在这种情况下为 NULL)但我的查询没有响应的所有名称。我知道至少一个人的 SUM 等于零(或 NULL),这是我的查询:
SELECT *
FROM (SELECT m.name AS nombre,
DATE(MIN(m.created_at)) AS fecharegistro,
SUM(p.amount) AS Total,
u.email AS Mail,
CONCAT(u.first_name, " ", u.last_name) AS Contacto
FROM payment p,
merchant m,
user u
WHERE p.merchant_id = m.uuid
AND p.user_id = u.uuid
GROUP BY m.name) AS inner_table
WHERE Total IS NULL