SELECT DISTINCT A.level3code,A.book,keywords FROM finalcat A
CROSS APPLY
(
-- Now get all the keywords for each level3 in XML
SELECT keyword + ', ' FROM keyword B WHERE A.level3code = B.level3code
and A.book=B.book and keyword is not null
FOR XML Path('')
) AS C (keywords) where keywords is not null
CROSS APPLY
(
-- Now get all the keywords for each level3 in XML
SELECT keyword + ', ' FROM keyword B WHERE A.level3code = B.level3code
and A.book=B.book and keyword is not null
FOR XML Path('')
) AS C (keywords) where keywords is not null
Comments
Post a Comment