WITH t AS ( SELECT 1 ID, '가' Product, 100 Price UNION ALL SELECT 1, '나', 200 UNION ALL SELECT 1, '다', 300 UNION ALL SELECT 2, '가', 100 UNION ALL SELECT 3, '나', 200 UNION ALL SELECT 4, '가', 100 UNION ALL SELECT 4, '다', 300 ) SELECT * FROM (SELECT ID, Product, Price , COUNT(CASE Product WHEN '가' THEN 1 END) OVER(PARTITION BY ID) cnt FROM t ) a WHERE cnt > 0 ORDER BY ID, Product ;