原始数据,需要拼接成一行
select * from (select d.*,(SELECT count ([Keyword])FROM [DragonGuoShi].[dbo].[ArticleInfo]where Keyword like'%'+d.Keyword+'%' and [ArticleCreateDate]>'2018-06-10') as Num from (select distinct(Keyword) from( select SUBSTRING( Keyword,number,CHARINDEX(',',Keyword+',',number)-number) as Keyword from( SELECT stuff((SELECT ','+[Keyword] from (SELECT [Keyword]FROM [DragonGuoShi].[dbo].[ArticleInfo]where Keyword!='' and [ArticleCreateDate]>'2018-06-10')a for xml path('')),1,1,'') as Keyword)b ,master..spt_values whereselect * from (select