标签:
表t_alibaba_data的数据结构如下:
各列含义分别是:
用户id(user_id),品牌id(brand_id),用户行为(type, 其中,点击为0,购买为1,加入收藏为2,加入购物车为3),产生行为的时间(visit_datetime)。
一、用一条sql语句,找出点击过热销品牌(Top10)的用户
select distinct user_id from t_alibaba_data where type = 0 and brand_id in (select brand_id from(select brand_id, count(brand_id) as new_brand_id from t_alibaba_data where type = 1 group by brand_id order by new_brand_id desc limit 0, 10)alias_t1);
标签:
原文地址:http://www.cnblogs.com/lasclocker/p/4456804.html