当前位置: 首页 > news >正文

南宁定制网站制作价格wordpress评论优化插件

南宁定制网站制作价格,wordpress评论优化插件,帮企业建网站,为拟建设的网站申请一个域名注#xff1a;参考文章#xff1a; SQL 之共同使用ip用户检测问题【自关联问题】-HQL面试题48【拼多多面试题】_hive sql 自关联-CSDN博客文章浏览阅读810次。0 问题描述create table log( uid char(10), ip char(15), time timestamp);insert into log valuesinsert into l…注参考文章 SQL 之共同使用ip用户检测问题【自关联问题】-HQL面试题48【拼多多面试题】_hive sql 自关联-CSDN博客文章浏览阅读810次。0 问题描述create table log( uid char(10), ip char(15), time timestamp);insert into log valuesinsert into log values(a, 124, 2019-08-07 12:0:0),(a, 124, 2019-08-07 13:0:0),(b, 124, 2019-08-08 12:0:0),(c, 124, 2019-0._hive sql 自关联https://blog.csdn.net/godlovedaniel/article/details/119858751 0 问题描述 1 数据准备 create table log (uid string,ip string,login_time string )row format delimited fields terminated by \t;insert into log values (a, 124, 2019-08-07 12:00:00), (a, 124, 2019-08-07 13:00:00), (b, 124, 2019-08-08 12:00:00), (c, 124, 2019-08-09 12:00:00), (a, 174, 2019-08-10 12:00:00), (b, 174, 2019-08-11 12:00:00), (a, 194, 2019-08-12 12:00:00), (b, 194, 2019-08-13 13:00:00), (c, 174, 2019-08-14 12:00:00), (c, 194, 2019-08-15 12:00:00); 2 数据分析 共同使用问题一般此类题型都需要一对多该问题的解决核心逻辑是自关联。 完整代码如下 selectt3.uid_1, t3.uid_2 from (selectt1.ip,t1.uid as uid_1,t2.uid as uid_2from (select uid, ip from log group by uid, ip) t1join(select uid, ip from log group by uid, ip) t2where t1.ip t2.ipand t1.uid t2.uid) t3 group by t3.uid_1, t3.uid_2 having count(ip) 3; 代码分析 step1: 获取自关联的结果集 selectt1.ip,t1.uid as uid_1,t2.uid as uid_2 from (select uid, ip from log group by uid, ip) t1join(select uid, ip from log group by uid, ip) t2on t1.ip t2.ip; step2: 由于数据会两两出现所以a,b和 b,a实际上是一样的需要过滤掉这部分重复数据只需要选出 t1.uid t2.uid即过滤掉a,b这组数据。hive中不支持不等连接故使用where语句 selectt1.ip,t1.uid as uid_1,t2.uid as uid_2 from (select uid, ip from log group by uid, ip) t1join (select uid, ip from log group by uid, ip) t2where t1.ip t2.ip and t1.uid t2.uid; step3:按照组合键分组并过滤出符合条件的用户 selectt3.uid_1, t3.uid_2 from (selectt1.ip,t1.uid as uid_1,t2.uid as uid_2from (select uid, ip from log group by uid, ip) t1join(select uid, ip from log group by uid, ip) t2where t1.ip t2.ipand t1.uid t2.uid) t3 group by t3.uid_1, t3.uid_2 having count(ip) 3; 3 小结 本案例题型属于“共同xx”例如共同好友、互相认识、共同使用等。遇到这类关键字的时候往往可以采用自关联的方式解决。笛卡尔积一对多去重取一
http://www.dnsts.com.cn/news/158958.html

相关文章:

  • 自己做动漫头像的网站智慧团建登录平台入口
  • 邢台兼职网站有哪些?响应式网站导航栏
  • 四川省建设工程造价信息网站wordpress edu v2.0
  • 盟族网站建设长沙市天心区城乡建设局网站
  • 阿里云oss做网站wordpress 漫画在线
  • 网站建设公司西安硅塑胶 东莞网站建设
  • 网络水果有哪些网站可以做济南企业免费建站
  • 校园二手网站建设目的意义个人网页设计实验报告
  • 单页面网站 seo做网站seo推广公司
  • 东营集团网站建设销售策划
  • 河北手机网站制作企业医院互联网网站建设
  • 网站建设和淘宝店装修是不是一样杭州市在建工程项目
  • 怎样建立个人的网站东凤镇做网站公司
  • 源码分享站网站建设与规划心得总结
  • 佛山微网站推广苏州论坛
  • 网站设计师待遇免费模板下载网站
  • 深圳外贸网站开发建设网站抽奖模块怎么做
  • 纯jsp做的留言板网站西安机械加工网
  • 建站工具搭建前台网站重庆网站免费优化
  • wordpress 开启多站点网站有效内容的宣传及推广
  • 免费建站网站一级大录像不卡在线看网页抖音小程序推广怎么做
  • 上海网站建设企业一个网站网站建设下来要花多少钱
  • 网站建设公司类型大连做企业网站排名
  • 信用 网站 建设方案网站简介 更改
  • 中小型网站建设流程企业网站建设兴田德润怎么联系
  • 溧水做网站自助服务平台
  • 化肥网站模板如何做网站页面赚钱
  • 做网站公司常熟微商城系统开发
  • 买个域名就可以建立网站吗昆山市建设工程质量检测中心网站
  • 如何用手机网站做淘宝客短视频营销优势