simple double IIF Solution
Simple Solution using iif twice\n\n\nselect id,\nIIF(p_id is null,\'Root\',IIF(id in (select p_id from Tree),\'Inner\',\'Leaf\')) as type\nfrom Tree\n
Simple Solution using iif twice\n\n```\nselect id,\nIIF(p_id is null,\'Root\',IIF(id in (select p_id from Tree),\'Inner\',\'Leaf\')) as type\nfrom Tree\n```
['MS SQL Server']