select result.* from (
select theme.*,@rownum:=@rownum+1,
if(@forum_id=theme.forum_id,@sort:=@sort+1,@sort:=1) as sort,
@forum_id = theme.forum_id from
(select * from bbs_theme where state = 0 and forum_id in
('2532cc83242d41f18c86595c053792e7') order by
forum_id DESC,top_num DESC,is_essence desc, replies DESC) theme,
(select @rownum:=0,@forum_id:=null,@sort:=0 ) a
) result where result.sort < 5
会被替换成
select result.* from (select theme.*,:=+1,if(=theme.forum_id,:=+1,:=1) as sort,
= theme.forum_id from (select * from bbs_theme where state = 0 and
forum_id in ('2532cc83242d41f18c86595c053792e7') order by forum_id DESC,t
op_num DESC,is_essence desc, replies DESC) theme,(select :=0,:=null,:=0 ) a) result where result.sort < 5
我想保留开始的语句中的@rownum,@forum_id,@sort 等应该如何处理