zoukankan      html  css  js  c++  java
  • 2.28

    # 地级市
    select *
    from (
    select a.id,
    a._id,
    a.provinceName,
    b.cityName,
    b.confirmedCount '确认感染',
    b.deadCount '死亡数',
    b.curedCount '治愈',
    # a.suspectedCount '疑似',
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') as utime


    from dxyarea a,
    dxyarea_city b
    where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    str_to_date('2020-01-30 00:00:00', '%Y-%m-%d %H:%i:%s')
    and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')
    and a.updateTime = (SELECT MAX(updateTime + 0)
    FROM dxyarea_city
    WHERE cityName = b.cityName)
    and a.country = '中国'
    and a._id = b.dxyarea_id
    group by b.cityName) aa
    order by aa.确认感染 desc, aa.provinceName, aa.cityName;

    #
    # select *
    # from dxyarea a
    #
    # where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    # str_to_date('2020-01-30 00:00:00', '%Y-%m-%d %H:%i:%s')
    # and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    # str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')
    # and a.provinceName like '%海南%'

    # 省级数据
    select a.id,
    a._id,
    max(CAST(a.updateTime as SIGNED)) as mutime,
    a.confirmedCount '确认感染',
    a.deadCount '死亡数',
    a.curedCount '治愈',
    # a.suspectedCount '疑似',
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') as utime,
    a.provinceName,
    a.confirmedCount,
    a.*
    from dxyarea a
    where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    str_to_date('2020-01-29 00:00:00', '%Y-%m-%d %H:%i:%s')
    and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')
    and a.updateTime = (SELECT MAX(updateTime + 0)
    FROM dxyarea
    WHERE provinceName = a.provinceName)
    and a.country = '中国'
    group by a.provinceName, a.confirmedCount
    order by a.confirmedCount desc;


    # 省级,每天的
    select a.id,
    a._id,
    a.provinceName,
    a.confirmedCount '确认感染',
    a.deadCount '死亡数',
    a.curedCount '治愈',
    # a.suspectedCount '疑似',
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') as utime,
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d') as udate,

    a.confirmedCount,
    a.*
    from dxyarea a
    where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    str_to_date('2020-01-24 00:00:00', '%Y-%m-%d %H:%i:%s')
    and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')

    and a.country = '中国'
    order by a.provinceName, utime desc;


    # 概览
    select sum(aa.confirmedCount) as '确诊总数',
    sum(aa.deadCount) as '死亡数',
    sum(aa.curedCount) as '治愈',
    aa.utime,
    aa.udate
    # sum(aa.suspectedCount) as '疑似'
    from (
    select a.id,
    a._id,
    a.confirmedCount,
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') as utime,
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d') as udate,
    a.deadCount,
    a.curedCount,
    a.suspectedCount,
    a.provinceName
    from dxyarea a
    where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    str_to_date('2020-01-29 00:00:00', '%Y-%m-%d %H:%i:%s')
    and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')
    and a.updateTime = (SELECT MAX(updateTime + 0)
    FROM dxyarea
    WHERE provinceName = a.provinceName)
    and a.country = '中国'
    group by a.provinceName, a.confirmedCount
    order by a.confirmedCount desc) aa

    # 概览
    select (aa.confirmedCount) as '确诊总数',
    (aa.deadCount) as '死亡数',
    (aa.curedCount) as '治愈',
    aa.utime,
    aa.udate
    # sum(aa.suspectedCount) as '疑似'
    from (
    select a.id,
    a._id,
    a.confirmedCount,
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') as utime,
    from_unixtime(left(a.updateTime, 10), '%Y-%m-%d') as udate,
    a.deadCount,
    a.curedCount,
    a.suspectedCount,
    a.provinceName
    from dxyarea a
    where from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') >=
    str_to_date('2020-01-29 00:00:00', '%Y-%m-%d %H:%i:%s')
    and from_unixtime(left(a.updateTime, 10), '%Y-%m-%d %H:%i:%s') <=
    str_to_date('2020-01-30 23:59:00', '%Y-%m-%d %H:%i:%s')
    and a.updateTime = (SELECT MAX(updateTime + 0)
    FROM dxyarea
    WHERE provinceName = a.provinceName)
    and a.country = '中国'
    group by a.provinceName, a.confirmedCount
    order by a.confirmedCount desc) aa

  • 相关阅读:
    试试用有限状态机的思路来定义javascript组件
    利用grunt-contrib-connect和grunt-connect-proxy搭建前后端分离的开发环境
    利用bootstrap的modal组件自定义alert,confirm和modal对话框
    利用轮播原理结合hammer.js实现简洁的滑屏功能
    等高分栏布局小结
    圣杯布局小结
    浏览器缓存知识小结及应用
    基于淘宝弹性布局方案lib-flexible的问题研究
    淘宝弹性布局方案lib-flexible实践
    Js位置与大小(1)——正确理解和运用与尺寸大小相关的DOM属性
  • 原文地址:https://www.cnblogs.com/maxin123/p/12378247.html
Copyright © 2011-2022 走看看