608 Tree Node

select id,

case when p_id is null then 'Root '

  when id in (select distinct p_id from tree where p_id is not null) then 'Inner'

  else 'leaf' end Type 

from tree

order id

猜你喜欢

转载自www.cnblogs.com/ffeng0312/p/9829174.html