with
t1 as(
select
substring_index(order_id,'_',-1) as product_id
from
order_log
)
,
t2 as(
select
product_id,
count(product_id) as cnt
from
t1
group by
product_id
order by
product_id
)
select * from t2

京公网安备 11010502036488号