zoukankan      html  css  js  c++  java
  • 利用with关键字实现数据查询的递归调用

    declare @sysCode nvarchar(50)
    declare @re table(id nvarchar(50),[level] int)   
    set @sysCode = '001';
    with cte as (
    select id,0 as [level] from T_SYS_Module
    where code =@sysCode
    union all
    select t1.id,t2.[level]+1 from T_SYS_Module t1,cte t2
    where t1.parentId=t2.id
    )
    insert  @re
    select * from cte
  • 相关阅读:
    IPUtil
    MD5Util
    MyBatis环境配置及入门
    淘宝主页(静态页面)第3天
    淘宝主页(静态页面)第二天
    淘宝主页(静态页面)第1天
    力扣20 有效的括号
    力扣1 two sum
    JAVA可变参数
    JAVA环形队列
  • 原文地址:https://www.cnblogs.com/poissonnotes/p/2352828.html
Copyright © 2011-2022 走看看