我有这个问题:
select
a.item_page_productid,
b.category_id,
a.viewcount
from
(select
item_page_productid,
count(*) as viewcount
from views
where eventdate > to_date(days_sub(now(), 60))
group by item_page_productid
) a
join
(select
product_id,
category_id
from catalog_products_in_categories
where active = 't') b
on a.item_page_productid=b.category_id
我要做的是将单个item_page_productid与单个category_id配对,item_page_productid配对是具有最高viewcount的那个。
有什么想法吗?