实际项目如遇到按照如地区这样树状结构的条件递归查询数据的场景中,可以使用. CREATE FUNCTION [dbo].[GetAllChildrenTypeById] ( ) ) RETURNS TABLE AS RETURN with cte as ( SELECT [id] ,[dictionaryTypeCode] ,[text] ,[parentId] ,[sort] ,[availabl] ,[leaf] ,[url] ,[value] FROM [Dictionary] where…