mysql如何自定义分析函数least及日期函数

MySQL如何自定义分析函数least及日期函数,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

芙蓉ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!

mysql 自定义分析函数 least 及 日期函数

为项目需要,由于mysql不提供分析函数least ,自己写了一个.供大家参考.

SELECT filename,
      uarfcn,
      cpi,
      dateTime,
      str_to_date(dateTime, '%H:%i:%s.%f'),
      (select dateTime
         from tdoas_scantest_cellerr tt
        where tt.filename = t.filename
          and tt.uarfcn = t.uarfcn
          and tt.cpi = t.cpi
          and tt.id > t.id
        order by id limit 1) cc,
      time_to_sec(timediff(str_to_date(dateTime, '%H:%i:%s.%f'),
                           (str_to_date((select dateTime
                                          from tdoas_scantest_cellerr tt
                                         where tt.filename = t.filename
                                           and tt.uarfcn = t.uarfcn
                                           and tt.cpi = t.cpi
                                           and tt.id > t.id
                                         order by id limit 1),
                                        '%H:%i:%s.%f')))) cc2
 from tdoas_scantest_cellerr t
where filename = '0702-主干道珞瑜路-4-122K-3[1].SCL.txt'
  and cpi = 53
  and uarfcn = 10055
order by id

[@more@]

另附上部分日期函数

str_to_date  :将字符转日期

timediff  :取两个日期的差值

time_to_sec :将日期转为秒

关于mysql如何自定义分析函数least及日期函数问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


当前题目:mysql如何自定义分析函数least及日期函数
URL分享:http://bzwzjz.com/article/jgiihj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设 品牌网站建设 网站制作 企业网站建设 网站制作公司 成都网站建设 成都网站建设公司 成都网站建设公司 网站建设 手机网站建设套餐 成都网站制作 成都网站设计 四川成都网站制作 成都网站设计 重庆电商网站建设 重庆网站制作 定制网站制作 梓潼网站设计 成都商城网站建设 成都h5网站建设 重庆网站建设 重庆企业网站建设