hive -- 协同过滤sql语句

版权声明:请注明出处:https://www.cnblogs.com/meiLinYa/ https://blog.csdn.net/meiLin_Ya/article/details/80978779

                                        hive -- 协同过滤sql语句

数据:

*.3g.qq.com|腾讯应用宝|应用商店
*.91rb.com|91手机助手|应用商店
*.app.qq.com|腾讯应用宝|应用商店
*.haina.com|腾讯应用宝|应用商店
*.myapp.com|腾讯应用宝|应用商店
*.sj.91.com|91手机助手|应用商店
0img.imgo.tv|芒果TV|手机视频
1.234.61.192|爱奇艺视频|手机视频
1.234.61.215|爱奇艺视频|手机视频
10.0.0.172|优酷视频|手机视频
10.0.0.172|多米音乐|手机音频
10.123.254.0|中国联通手机音乐|手机音频
10.123.254.122|优酷视频|手机音频
10.123.254.122|中国联通手机音乐|手机音频
10.123.254.21|沃电台|手机音频
10.123.254.22|音悦Tai|手机音频
10.123.254.22|沃音悦台|手机音频
10.123.254.23|沃音悦台|手机音频
10.123.254.24|沃唱吧|手机音频
10.123.254.25|炫铃DIY|手机音频

根据sql 根据内容推荐  商品类型

思路:

        1 拿到制定ip的 type
        2 根据type 拿它都有什么类型

        3 排除自己看过的类型 剩下的就是推荐给他的

    select t2.source
from(
select distinct(tab1.source) source
from(
select type
from tab1
where ip='10.123.254.22') t1,tab1
where t1.type=tab1.type) t2 left outer join(
select distinct(source)
from tab1
where ip='10.123.254.22') t3
on t2.source=t3.source
where t3.source is null;



猜你喜欢

转载自blog.csdn.net/meiLin_Ya/article/details/80978779