首页 > 代码库 > SQL SERVER 之 WITH AS 递归

SQL SERVER 之 WITH AS 递归

WITH    Category_Tree          AS ( SELECT   Code               FROM     SubjectDB.Supplier.SupplierCategory               WHERE    Code LIKE 0101%             )SELECT  *FROM    SubjectDB.Supplier.SupplierCategoryWHERE   Code IN ( SELECT    *                      FROM      Category_Tree ) 

查询结果:

技术分享

SQL SERVER 之 WITH AS 递归