![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MySQL
Troyong
这个作者很懒,什么都没留下…
展开
-
mybatis-plus QueryWrapper条件子句多重与或
鄙人在项目中遇到一个业务要计算月同比和环比,需要查询一个时间字段中多个时间范围的记录,实现的SQL示例如下:select * from fault_happen where train_code = '710' and fault_level = '3' and (happen_time >= '2020-07-01 00:00:00' and happen_time < '2020-08-01 00:00:00'OR happen_time >= '2020-06-01 00:00原创 2020-08-03 15:11:58 · 2546 阅读 · 0 评论 -
MySQL常用函数max()和length()使用
MySQL max()函数用于找出指定记录集中字段值最大的记录:SELECT MAX(combine_time) from fault_time;查询结果如下:---------------------------------------------------------------------分割线-------------------------------------------...原创 2019-09-03 09:50:30 · 2546 阅读 · 0 评论 -
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
如题,limit不能与in/all/any/some连用,update fault_time set combine_time = '' where combine_time in (SELECT LENGTH(max_len.combine_time) from (SELECT LENGTH(combine_time) from phm_fault_repair ORDER BY LENGTH...原创 2019-09-06 14:24:12 · 2764 阅读 · 0 评论