Guest User

Untitled

a guest
Aug 5th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. The following query qorks beautifully, taking all rows of results into a comma-delimited string:
  2.  
  3. declare @data varchar(8000)
  4. select @data = coalesce(@data + ',','') + CAST(p.title AS VARCHAR(50))
  5. from adminPermission p
  6. INNER JOIN adminUserPermissionAssoc a
  7. ON p.id = a.adminPermissionID
  8. WHERE a.adminUserID = 2
  9. select @data
  10.  
  11. My isue comes in when I want that query ran as a subquery of this query (it would be placed in the parentheses in the select list)
  12.  
  13. SELECT
  14. u.id as adminID,
  15. u.fullName as fullName,
  16. (
  17.  
  18. ) as permissionGroups
  19. FROM
  20. adminUser u
  21. WHERE
  22. u.username = 'psawhney'
  23. AND u.password = 'a8eaf1d74dc182ad4f9ff4b775dae756'
  24.  
  25. Does anyone know how to accomplish this?
Add Comment
Please, Sign In to add comment