oracle start with connect by怎么转换到mysql中

2025-02-23 11:45:12
推荐回答(1个)
回答1:

在Oracle中sql代码如下编写

select o.orgid from t_organization o
connect by prior o.orgid = o.orgparentid
start with o.orgid = #{params.swjgDm}

那么在MySQL数据库中需要改为如下方式

select o.orgid from t_organization o where
(o.ORGPARENTIDS LIKE concat('%/',#{params.swjgDm},'/%')
or o.ORGID =#{params.swjgDm}) and o.AVAILABLE ='1'