SELECT TOP (5) p.Name AS ProductName
, STUFF((SELECT TOP (5) ', ' + CAST(t.TransactionID AS VARCHAR(20))
FROM [AdventureWorks2014].[Production].[TransactionHistory] t
WHERE T.ProductID = p.ProductID FOR XML PATH('')), 1, 1, '') as TransactionIds
FROM [AdventureWorks2014].[Production].Product p
SELECT Users.* FROM UserLists
INNER JOIN UsersInUserLists On UsersInUserLists.UserListID = UserLists.ID
INNER JOIN Users ON Users.ID = UsersInUserLists.UserID
WHERE UserList.Name = 'list name' -- or if you know an ID value: WHERE UserList.ID = 3
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Open in new window