If article_payments table is null the query returns null. How shoul i set the query yo get recors if doesnt exist in SUM(payment_total
) like 0.00 ?
SELECT article_name,user_real_name,user_name,SUM(`article_payment`) as holding,paid
FROM article_articles AS t1
JOIN article_users ON (t1.article_name=article_users.user_id)
JOIN (SELECT user_id,SUM(`payment_total`) as paid FROM article_payments GROUP BY user_id) AS t2 ON (t1.article_name=t2.user_id)
GROUP BY t2.user_id
No comments:
Post a Comment