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,请高手指点。
userid 是主键,干嘛还要 group by userid ??
主键必须唯一,再 group 就画蛇添足了
userid 是主键,干嘛还要 group by userid ??
主键必须唯一,再 group 就画蛇添足了
再查询结果 是什么意思?
inner join 和 left join 有不同的结果集,不能用 或 并列起啦
再查询结果 是什么意思?
inner join 和 left join 有不同的结果集,不能用 或 并列起啦
才发现你查的是同一张表
那自连接不就可以了吗?
才发现你查的是同一张表
那自连接不就可以了吗?
大致这样吧
select userid from team_enewsmember a, team_enewsmember b where a.agentid=b.userid and b.agentid='2' and b.levelid>=1 and a.levelid>=1
大致这样吧
select userid from team_enewsmember a, team_enewsmember b where a.agentid=b.userid and b.agentid='2' and b.levelid>=1 and a.levelid>=1
你是查级联数据吗?那要用递归,或修改数据结构
如果只是固定的 4 级以内,这样也凑合
你是查级联数据吗?那要用递归,或修改数据结构
如果只是固定的 4 级以内,这样也凑合
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号