# 1045. Customers Who Bought All Products [leetcode](https://leetcode.com/problems/customers-who-bought-all-products/description/)   這一題要我們找出擁有買完所有product的customer 所以我們先將 customer 分組 當我們分組的customer的product訂單數 = 總訂單 就是答案 ```SQL select customer_id from customer group by customer_id having count(distinct product_key ) = (select count(product_key ) from product) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up