![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MYSQL
weixin_34422383
这个作者很懒,什么都没留下…
展开
-
索引失效问题,不知道原因
一: select ID,b.STAND_ID,b.STATION_ID,GROUP_ID,a.OP_TIME,a.BATCH_NUMBER from data_collect a inner join (SELECT STATION_ID,STAND_ID, max(BATCH_NUMBER) as BATCH_NUMBER FROM d...原创 2018-04-08 09:43:29 · 992 阅读 · 1 评论 -
left join 或right join 加上where条件后连接失效,等同于inner join
原因:where是先连接然后再筛选 举例:表1: 表2:查询语句:select * from tab1 left JOIN tab2 on (tab2.id=tab1.id) where tab2.hobby = "游泳";结果:过程:先生成中间表:再where 条件过滤。 所以left join 失效。解决办法:将where 换成and 即:查询语句:select * from ta...原创 2018-03-26 11:12:39 · 4682 阅读 · 0 评论