इसे शून्य के साथ तिथियां नहीं मिलती हैं, इसके लिए आपको तिथियों के माध्यम से लूप करने के लिए दिनांक तालिका या संग्रहीत प्रक्रिया की आवश्यकता होगी। इसे करने का एक तरीका संघ क्वेरी (अनचाहे) से उप-चयन है:
SELECT commission_date, SUM(click_commission), SUM(lead_commission), SUM(total_commission)
FROM (SELECT DATE(click.time) AS commission_date, click.commission AS click_commission,
0 AS lead_commission, click.commission AS total_commission
FROM click
UNION ALL
SELECT DATE(lead.time) AS commission_date, 0 AS click_commission,
lead.commission AS lead_commission, lead.commission AS total_commission
FROM lead) AS foo
GROUP BY commission_date
ORDER BY commission_date