-- Преобразовать таблицу в вид: Level1, Level2, Level3, Level4
with products as
(
select 'Appliances' as Category, 1 as ID, NULL as ParentID
union all
select 'Home Appliances', 2, 1
union all
select 'Vacuum Cleaners', 3, 2
union all
select 'Robotic Vacuum Cleaners', 4, 3
union all
select 'Food', 5, NULL
union all
select 'Milk Products', 6, 5
union all
select 'Milk', 7, 6
union all
select 'Appliances', 1, NULL
union all
select 'Health and Beauty Equipment', 8, 1
union all
select 'Massage Equipment and Accessories', 9, 8
union all
select 'Massage Pillows', 10, 9
union all
select 'Household Chemicals', 11, NULL
union all
select 'Dishwasher Products', 12, 11
union all
select 'Dishwasher Tablets', 13, 12
)
select *
from products