循环查询问题
source depend depend_filename
IM200908210099PM200908260001rootcause
IM200908210099PM200908260002cm3t
IM200908210099PM200908260003rootcause
IM200908210099PM200908260004cm3t
表名为a
首先有一个编号IM200906250048,根据这个编号查询select source,depend,depend_filename from a where source='IM200906250048',
然后再把查询出来的depend当作SOURCE继续查select source,depend,depend_filename from a where source='PM200908260001',
然后再将查询出来的depend再作为source继续查询,就这样一直循环下去,直到查询出来的depend没有数据为止,请问一下大家该怎么处理呢?
[解决办法]
参考:
SELECT * from a
WHERE depend is not null
connect by prior depend=source start with source='IM200906250048'