There is a table of the form:
id int not null parent int null ... Where parent indicates the id of the parent. It is necessary for a given id to get a list of all descendants to the very last. It seems to be a common task, are there ready-made solutions or do you need to invent your own?
DBMS MS SQL 2012