废少看码
单表SQL及数据:
select * from SZ_CYJGTZ_MAP
级联查询:
SELECT
a.STATUS_CODE, a.STATUS_DESC, b.STATUS_CODE bCode , b.STATUS_DESC bDesc FROM SZ_CYJGTZ_MAP a LEFT JOIN SZ_CYJGTZ_MAP b ON b.PARENT_CODE = a.STATUS_CODEwhere b.STATUS_CODE is not null
ps:一定要加别名,过滤条件
结果: