您当前的位置: 首页 >  sql

qq_34412985

暂无认证

  • 0浏览

    0关注

    1061博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

sql 用户变量@使用

qq_34412985 发布时间:2019-01-29 19:17:33 ,浏览量:0

select * from (select t2.id,t2.category_name,t2.category_level,t2.parent_id,t2.checkBox,t2.sort from(select @r as _id,(select @r := parent_id from category where id=_id)as parent_id,@l :=@l+1 as lvl from (select @r := #{id,jdbcType=INTERGER},@l :=0) vars,category h where @r ]]>0)t1 join category t2 on t1._id=t2.id and t2.id !=#{id,jdbcType=INTERGER} and t2.community_code = #{communityCode,jdbcType=varchar} order by t1.lvl desc)t4 left join property vy on t4.id=vy.category_id left join proprety_value vl on vy.id=vl.property_id order by t4.sort asc,vl.sort asc

sql中添加行号

select (@r :=@r+1)rowNo from (select @r:=0)t

关注
打赏
1653291990
查看更多评论
立即登录/注册

微信扫码登录

0.0392s