Problem Description –
Write an SQL query that will, for each date_id
and make_name
, return the number of distinct lead_id
‘s and distinct partner_id
‘s.
Return the result table in any order.
The query result format is in the following example.

Problem Link – Daily Leads
Difficulty Level – Easy
Solution –
SELECT
date_id,
make_name,
COUNT(DISTINCT lead_id) as unique_leads,
COUNT(DISTINCT partner_id) as unique_partners
FROM DailySales
GROUP BY 1, 2