select user_id, product_id
from
(
select user_id, product_id, count(*) purchase_count
from online_sale
group by user_id, product_id
)a
where purchase_count >= 2
select distinct a.user_id, a.product_id
from online_sale a join online_sale b on a.user_id = b.user_id
and a.product_id = b.product_id and a.sales_date <> b.sales_date