Something like that
SELECT B FROM [Container].Products as P OUTER APPLY P.Bills AS B WHERE P.ProductID == 1
will create a string for each bit
Another variant:
SELECT P, (SELECT B FROM P.Bills) FROM [Container].Products AS P WHERE P.ProductID == 1
A row will be created for each corresponding product (in this case, only one) and the second column in the row will include a nested result set containing accounts for this product.
Hope this helps
Alex
source share