https://leetcode.com/problems/products-price-for-each-store/
select product_id,
max(case when store = 'store1' then price end) as store1,
max(case when store = 'store2' then price end) as store2,
max(case when store = 'store3' then price end) as store3
from Products
group by product_id
728x90
반응형
'자료구조 알고리즘 > 코딩테스트' 카테고리의 다른 글
1421. NPV Queries (0) | 2022.06.24 |
---|---|
740. Delete and Earn (0) | 2022.06.18 |
1623. All Valid Triplets That Can Represent a Country (0) | 2022.06.18 |
1587. Bank Account Summary II (0) | 2022.06.18 |
1571. Warehouse Manager (0) | 2022.06.18 |