省市级联找子集
Posted 上帝视角
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了省市级联找子集相关的知识,希望对你有一定的参考价值。
找到全部子集
WITH TEMP AS
(
SELECT * FROM CM_Region WHERE RegionCode=‘110000‘
UNION ALL
SELECT T0.* FROM TEMP,CM_Region T0 WHERE TEMP.RegionCode=T0.ParentCode
)
SELECT RegionCode FROM TEMP
----------------------------------------------------------------
--子集拼接
SELECT ‘,‘+BusinessName FROM (SELECT T2.BusinessName FROM Sal_PromoteBusinessLine T1
LEFT JOIN CO_Business T2 ON T1.BusinessID =T2.ID
WHERE T1.PromoteID = 34) T1 FOR XML PATH(‘‘)
以上是关于省市级联找子集的主要内容,如果未能解决你的问题,请参考以下文章