Last active
December 28, 2015 02:49
-
-
Save brandedoutcast/7430403 to your computer and use it in GitHub Desktop.
Get Multiple Phones For Single Customer without using mutiple inner joins.
This file contains 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 DISTINCT | |
STUFF((SELECT DISTINCT ',' + CP.Phone_Nbr | |
FROM Customer_Phone CP | |
WHERE CM.Cust_Nbr = CP.Cust_Nbr | |
FOR XML PATH(''), TYPE) | |
.value('.', 'NVARCHAR(MAX)'), 1, 2, '') Phones | |
FROM Customer_Phone CM where CM.Cust_Nbr = 321 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment