explain select userid from team_enewsmember where agentid in(select userid from team_enewsmember where agentid='2' and levelid>=1 group by userid) and levelid>=1 group by userid
如果主键userid与agentid联合索引就会出现 Using where; Using index
怎么都去不掉 Using where; Using filesort,请高手指点。
...全文
104810打赏收藏
mysql 优化问题 Using where; Using filesort
explain select userid from team_enewsmember where agentid in(select userid from team_enewsmember where agentid='2' and levelid>=1 group by userid) and levelid>=1 group by userid 如果主键userid与agentid联合索引就会出现 Using where; Using index 怎么都去不掉 Using where;
select a.userid from team_enewsmember as a,team_enewsmember as b where a.userid=b.userid and b.agentid='2' and b.levelid>=1
select a.userid 谢谢!这样可以了,第三级节点以及第四级怎么查,第三级把自连接作为子查询吗?
2的第一个节点3
3的第一个节点4,
4的第一个节点5