---
# System prepended metadata

title: 1693. Daily Leads and Partners
tags: [' LeetCode', sql]

---

---
tags: sql, LeetCode
---
# 1693. Daily Leads and Partners
(資訊來自於`leetcode 1693`[ Daily Leads and Partners](https://leetcode.com/problems/daily-leads-and-partners/))

### 每日線索和合作夥伴
![](https://i.imgur.com/eZUMov5.png)
編寫一個 SQL 查詢，對於每個date_idand make_name，返回不重複 lead_id和不重複 partner_id的數量。
![](https://i.imgur.com/WugAbWS.png)

### 解題方式：
```sql=
SELECT 
    date_id,
    make_name,
    count(distinct lead_id) unique_leads,
    count(distinct partner_id) unique_partners
    from DailySales
    group by date_id,make_name
```

### 解題解析：
利用sql的distinct的關鍵字來過濾重複出現的紀錄值，這樣我們就可以取得題目所需要的不重複值