zoukankan      html  css  js  c++  java
  • mysql oracle sql获取树 父级 子级 及自己

           select * from ( select t.*,d.TABLE_NAME,d.QUERY_SQL,d.data_control_col,d.id table_id,d.where_sql
            from REPORT_KPI_INFO t
            left join REPORT_KPI_TABLE_INFO d
            on t.id = d.kpi_id
            where t.kpi_status=1
            <if test="keyword != null and keyword != ''">
                and t.id in
                (select t.id
                from REPORT_KPI_INFO t
                start with t.id in (select t.id
                from REPORT_KPI_INFO t
                where t.kpi_name like '%'||#{keyword}||'%')
                connect by t.id = prior t.parent_id)
                union
    
                select t.*,
                d.TABLE_NAME,
                d.QUERY_SQL,
                d.data_control_col,
                d.id table_id,
                d.where_sql
                from REPORT_KPI_INFO t
                left join REPORT_KPI_TABLE_INFO d
                on t.id = d.kpi_id
                where t.kpi_status = 1
                and t.id in
                (select t.id
                from REPORT_KPI_INFO t
                start with t.id in (select t.id
                from REPORT_KPI_INFO t
                where t.kpi_name like '%'||#{keyword}||'%')
                connect by prior t.id = t.parent_id)
            </if>
            )
            order by to_number(kpi_sort)
    
    -------------------------------------------------------------------------
    ## 极客时间全网最便宜最优惠购买方式,优惠券返现 百度网盘 微信关注公众号“选门好课”
    扫描下方二维码关注我的公众号"选门好课",与我一起交流知识
  • 相关阅读:
    兰迪·波许教授的最后一课
    How can I convert from GdiPlus::Image to CBitmap?
    环境变量以及ControlSet
    判断操作系统类型的多种方法
    顺序表
    操作系统版本号
    64bit操作系统的重定向
    CListCtrl资料
    Custom draw 和 Owner draw 的区别
    Silent Install / Uninstall
  • 原文地址:https://www.cnblogs.com/singworld/p/12059648.html
Copyright © 2011-2022 走看看