如果 makale_payments 表为空,则查询返回空。如果 SUM( payment_total
) 中不存在像 0.00 这样的查询,我应该如何设置查询以获取记录?
SELECT article_name,user_real_name,user_name,SUM(`article_payment`) as holding,paid
FROM makale_articles AS t1
JOIN makale_users ON (t1.article_name=makale_users.user_id)
JOIN (SELECT user_id,SUM(`payment_total`) as paid FROM makale_payments GROUP BY user_id) AS t2 ON (t1.article_name=t2.user_id)
GROUP BY t2.user_id