Created
January 21, 2016 22:34
-
-
Save rfay/97fa621948fbf1cf3f72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TOP 1000 pi.SubscriberId, | |
STUFF(( | |
SELECT ',' + tct.CategoryType + '=' + tc.CategoryDescription | |
FROM SML_Auth.dbo.TSL_User_Categories tuc | |
LEFT JOIN SML_Auth.dbo.TSL_Categories tc ON tc.CategoryId=tuc.CategoryId | |
LEFT JOIN SML_Auth.dbo.TSL_CategoryTypes tct ON tc.CategoryTypeId=tct.CategoryTypeId | |
WHERE pi.SubscriberId=tuc.SubscriberId | |
FOR XML PATH('')),1,1, '') AS categories | |
FROM TES_Connect_SML.dbo.TES_PROFILE_PERSONALINFORMATION pi | |
GROUP BY pi.SubscriberId | |
ORDER BY pi.SubscriberId DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment