我有一个带有连接的 sql server 2008 存储过程,它返回多行:
default ~/ / NULL NULL NULL Lorem
default ~/ / NULL NULL NULL Ipsum
我想将这两行作为最后一列组合返回:
default ~/ / NULL NULL NULL Lorem, Ipsum
我的程序如下
BEGIN
SET NOCOUNT ON;
SELECT
p.display_name AS Name,
p.url AS Url,
ISNULL(REPLACE(parentPage.url,'~','') + parentPage.alias,REPLACE(p.url,'~','')) as ParentPageURL,
p.page_image AS PageImage,
p.synopsis AS Synopsis,
p.metatitle AS Metatitle,
t.tag_name as tag
FROM page p
LEFT JOIN page parentPage on parentPage.id = p.parentid
LEFT JOIN page_features pf on p.id = pf.pageid and (pf.feature_type = 'TEXT' OR pf.feature_type = 'BLOG')
JOIN dbo.tag_collection_tag tc on tc.tag_collection_id = p.tag_collection_id
JOIN dbo.tag t on t.id = tc.tag_id
JOIN dbo.[Split](UPPER(@tags),',') Split on UPPER(t.tag_name) like '%' + split.Data + '%'
WHERE p.status = 'PUBLISHED'
AND p.include_in_nav = 1
AND (p.pagelevel = @level OR @level IS NULL)
AND (p.section_id = @sectionId OR @sectionId IS NULL)
ORDER BY ISNULL(REPLACE(parentPage.url,'~','') + parentPage.alias,REPLACE(p.url,'~',''))
END
谢谢你。