一 sql 语句递归写法
with recursive tmp as (
select f1.*
from folder f1 where f1.id = #{groupId}
union all
select f2.*
from folder f2, tmp f3
where f2.super_id = f3.id
)
select f.* from tmp f
二 sql 语句的case when 使用:
- 当某个字段多种属性的时候,怎么查询
select c.caseno,c.casenam,c.hostmanname,(case when f.casecost_lkfs='1‘ then '涉案资金' when f.casecost_lkfs='2' then '保证金' end) as lx,f.casecost_rq,f.casecost_type,f.casecost_jer,f.casecost_jkre from fy_casec