用户
 找回密码
 入住 CI 中国社区
搜索
查看: 987|回复: 0
收起左侧

[HELP] sql求优化

[复制链接]
发表于 2015-7-1 23:59:08 | 显示全部楼层 |阅读模式
select * from
(select *,(@i:= @i+1) AS r from nl_group g,(select @i:=0) b order by end_time desc) a
        where r>(select r from
     (select *,(@i:= @i+1) AS r from nl_group g,(select @i:=0) b  order by end_time desc) a  
     where gid=1)

以上的sql已经达到我想要的,但是感觉写的好复杂,那个a不能在里面复用么

本版积分规则