zoukankan      html  css  js  c++  java
  • Mysql其他

    select *   from 
        (select city,usage_percent from cdn_usage_city_5min where time='{getTime()}'  and city  not like '%未知%' ) as a 
        LEFT  JOIN 
        (select city,carton_rate_percent from carton_city_5min where time ={getTime()}) as b on a.city=b.city
        LEFT JOIN (select cdn_city,rate_percent from schedule_rate_5min where bras_city=cdn_city and time ={getTime()} ) as d on d.cdn_city=b.city
        LEFT JOIN (select city,avg_hot_covered_rate_percent from db_ott_{yestaday_date}.hot_covered_cdn_city where city !="未知CDN") as e on e.city=a.city
        LEFT JOIN (select city,total_count from user_count_city_5min where    time ={getTime()} ) as f on f.city=a.city
         

    连表范例

    更新或者插入

    #如果主键或唯一键 的数据 已经存在 那么就更新   不存在冲突的唯一键就插入 

    replace into carton_cdn_5min(city,node,cdnip,stb_bad_quality_percent,affected_bras_area_percent, time) values("温州3","东头2","192.168.0.12",602,702,12);

    除数为0

    case  when 分母=0 then NULL else 分子/分母 end

    select *,new_rate*100 as rate from {self.table} where  (case when ts_count=0 then 0 else m3u8_count/ts_count end) >= {multi}
  • 相关阅读:
    uniapp版本迭代
    上传图像裁剪功能
    uniapp 复制到剪切板
    uniapp吸顶功能
    地图导航到目的地
    uniapp视频图片上传
    获取昨天今天明天的时间
    【VUE】 前端面试题小结
    vue获取当前时间 实时刷新
    CSS linear-gradient() 函数
  • 原文地址:https://www.cnblogs.com/xzqpy/p/12697562.html
Copyright © 2011-2022 走看看