m0_70227179 2022-05-30 15:11 采纳率: 62.5%
浏览 34
已结题

MYSQL 以及oralce 数据库中 如何分组去计数重查询

环境如下:
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('1', '60.174.86.8', '220', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('10', '240e:45b:800:bba7::1', '220', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('11', '240e:45b:800:bba7::1', '2021', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('12', '240e:45b:800:bba7::1', '210414', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('13', '240e:45b:800:bba7::1', '210414', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('14', '240e:45b:800:bba7::1', '1226', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('15', '60.168.18.130', '220', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('16', '60.168.18.130', '2021', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('17', '60.168.18.130', '210414', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('18', '60.168.18.130', '1226', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('19', '60.168.18.130', '220', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('2', '240e:45b:800:bba7::1', '2021', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('20', '60.168.18.130', '2021', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('21', '60.168.18.130', '210414', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('22', '36.5.174.84', '1226', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('23', '36.5.174.84', '220', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('24', '36.5.174.84', '1226', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('25', '36.5.174.84', '220', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('26', '36.5.174.84', '2021', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('27', '240e:45b:800:bba7::1', '210414', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('28', '36.4.78.66', '1226', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('29', '112.27.52.101', '220', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('3', '60.168.18.130', '210414', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('30', '117.65.204.62', '2021', '2019-05-06');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('4', '36.5.174.84', '1226', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('5', '60.174.86.8', '220', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('6', '60.174.86.8', '2021', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('7', '60.174.86.8', '210414', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('8', '60.174.86.8', '220', '2019-05-05');
INSERT INTO cs_table(id, ip, act_number, data) VALUES ('9', '60.174.86.8', '2021', '2019-05-05');

其中act_number 是活动代号,求每个活动每天的UV是多少,也就是先按日期,再按act_number 分组之后去重
在计数,得到以下结果:

img

请问如何在MYSQL 以及oralce 实现

  • 写回答

3条回答 默认 最新

  • 笑看风云路 大数据领域优质创作者 2022-05-30 15:59
    关注

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 6月7日
  • 已采纳回答 5月30日
  • 创建了问题 5月30日

悬赏问题

  • ¥15 Odoo17操作下面代码的模块时出现没有'读取'来访问
  • ¥50 .net core 并发调用接口问题
  • ¥15 网上各种方法试过了,pip还是无法使用
  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 Hadoop集群部署启动Hadoop时碰到问题
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 QTableWidget重绘程序崩溃
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题