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

大连市网站建设_网站建设公司_安全防护_seo优化

南昌网站建设推广,wordpress nginx伪静态配置,上海网站设计开发公司,wordpress 页面文件目录 问题#xff1a;SQL解答#xff1a; 问题#xff1a; 现在有一张用户登陆日志表#xff0c;该表包括user_id,ip,log_time三个字段#xff0c;现在需要找出共同使用ip数量超过3个(含)的所有用户对。比如下面的示例数据#xff0c;101和102用户共同使用的ip为4个SQL解答 问题 现在有一张用户登陆日志表该表包括user_id,ip,log_time三个字段现在需要找出共同使用ip数量超过3个(含)的所有用户对。比如下面的示例数据101和102用户共同使用的ip为4个101和103用户共同使用的ip为3个102和103用户共同使用的ip为3个。 (101,192.168.10.101,2022-05-10 11:00:00), (101,192.168.10.101,2022-05-10 11:01:00), (101,192.168.10.102,2022-05-10 11:02:00), (101,192.168.10.103,2022-05-10 11:03:00), (101,192.168.10.104,2022-05-10 11:04:00),(102,192.168.10.101,2022-05-10 11:04:30), (102,192.168.10.102,2022-05-10 11:05:00), (102,192.168.10.103,2022-05-10 11:06:00), (102,192.168.10.104,2022-05-10 11:07:00),(103,192.168.10.102,2022-05-10 11:08:00), (103,192.168.10.103,2022-05-10 11:08:00), (103,192.168.10.104,2022-05-10 11:10:00),(104,192.168.10.103,2022-05-10 11:11:00), (104,192.168.10.104,2022-05-10 11:12:00),(105,192.168.10.105,2022-05-10 11:13:00)SQL解答 问题的关键点是使用自连接先按用户和ip去重之后进行自关联。因为如果公共使用ip达到3个及以上的话那么同一个用户对至少会出现3条数据筛选一下就行。 with user_login as ( select 101 as user_id ,192.168.10.101 as ip ,2022-05-10 11:00:00 as log_time union all select 101 as user_id ,192.168.10.101 as ip ,2022-05-10 11:01:00 as log_time union all select 101 as user_id ,192.168.10.102 as ip ,2022-05-10 11:02:00 as log_time union all select 101 as user_id ,192.168.10.103 as ip ,2022-05-10 11:03:00 as log_time union all select 101 as user_id ,192.168.10.104 as ip ,2022-05-10 11:04:00 as log_time union all select 102 as user_id ,192.168.10.101 as ip ,2022-05-10 11:04:30 as log_time union all select 102 as user_id ,192.168.10.102 as ip ,2022-05-10 11:05:00 as log_time union all select 102 as user_id ,192.168.10.103 as ip ,2022-05-10 11:06:00 as log_time union all select 102 as user_id ,192.168.10.104 as ip ,2022-05-10 11:07:00 as log_time union all select 103 as user_id ,192.168.10.102 as ip ,2022-05-10 11:08:00 as log_time union all select 103 as user_id ,192.168.10.103 as ip ,2022-05-10 11:08:00 as log_time union all select 103 as user_id ,192.168.10.104 as ip ,2022-05-10 11:10:00 as log_time union all select 104 as user_id ,192.168.10.103 as ip ,2022-05-10 11:11:00 as log_time union all select 104 as user_id ,192.168.10.104 as ip ,2022-05-10 11:12:00 as log_time union all select 105 as user_id ,192.168.10.105 as ip ,2022-05-10 11:13:00 as log_time ), tmp as (select user_id,ipfrom user_login --实际换成自己的表或上面的样例数据group by user_id,ip --同一个ip同一用户可能多次登录先去重 )select t1.user_id ,t2.user_id ,count(t1.ip) as ip_cnt from tmp t1 inner join tmp t2 on t1.ipt2.ip --通过ip自关联 where t1.user_idt2.user_id --因为存在101对102,102对101的情况保留一种即可 group by t1.user_id,t2.user_id having ip_cnt3 --保留用户对ip数量超过3个的含
http://www.ihoyoo.com/news/6650.html

相关文章:

  • 网站可以做什么2023年最新法定传染病有哪些
  • 网站建设 保定建设旅游信息网站的好处
  • 网站集约化平台建设网站实现多模板切换
  • 制作小程序网站源码WordPress主题(模板)制作教程
  • 万户网站建设网站改版说明
  • 网站文字特效如何咨询网络服务商
  • 济南网站建设设计制作公司那个网站可以做空比特币
  • 加强网站的建设工作的通知wordpress comer
  • 公司网站开发的流程上海高端品牌网站建设专家
  • 青岛建设厅官方网站wordpress去掉rss订阅
  • 网站建设qq群wordpress自动获取标签
  • 给朋友做的相册网站没有了上国外网站哪个dns快
  • 温州百度seo杭州seo排名优化
  • 怎么做视频解析的网站拍摄宣传片收费标准
  • 前台网站模板怎么做淘宝客网站备案
  • 衡水外贸网站建设梦幻西游手游网页版官网
  • 设计公司网站模板河南省网上商城采购平台
  • 360 的网站链接怎么做店面设计装修网
  • 蔺市网站建设网站建设科技项目申报书范文
  • 申请网站步骤专门做旅游的视频网站
  • 成都网站建设设计搜索引擎营销的实现方法有
  • 给文字做网站链接网站登录模板
  • dede添加网站背景关于免费制作网页的网站
  • 专业网站定制报价网页设计高端
  • 平面设计国外网站搭建小程序多少钱
  • 黄骅网站建设公司网站做论坛
  • 网站后台 更新缓存网站的域名每年都要续费
  • 如何做自己网站的访问记录广州网站制作知名 乐云践新
  • 手机网站案列微信做商城网站
  • 网站备案期间打不开什么网站做优化最好