TypeErrorNone
V2EX  ›  问与答

求助, mysql + grafana 数据展示的 sql 怎么写呢?

  •  
  •   TypeErrorNone · Sep 24, 2019 · 2458 views
    This topic created in 2426 days ago, the information mentioned may be changed or developed.

    表的字段:

    image

    CREATE TABLE `user_log` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `uid` bigint(20) unsigned NOT NULL DEFAULT '0',
      `request_id` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
      `event` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
      `coin` int(10) NOT NULL DEFAULT '0',
      `mobile` int(10) NOT NULL DEFAULT '0',
      `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `update_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=269 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户操作日志表';
    

    想实现按照 event 来展示数据,单位时间内 event 出现的次数,类似这种

    image

    求助这个 sql 怎么写呢?

    image

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1135 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:02 · PVG 02:02 · LAX 11:02 · JFK 14:02
    ♥ Do have faith in what you're doing.