複数の行を返す結合を持つSQL Server 2008ストアドプロシージャがあります。
default ~/ / NULL NULL NULL Lorem
default ~/ / NULL NULL NULL Ipsum
これらの 2 つの行を、最後の列を組み合わせた 1 つとして返したいと思います。
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
ありがとうございました。