Jump to content
  • 0

Query Results as a Simple List?


NontechnicalAdam

Question

As you might guess from my username, I am nontechnical--but I am learning quickly.

I have a junction table with UserID related to ObjectID according to RoleID.

I want to be able to query the ObjectID and Role ID and have it return a string such as, "RoleID: [User1], [User2]"

I apologize if this is answered elsewhere. I have looked fairly extensively, but I do not know the correct verbiage to search for such a solution.

All help is appreciated.

Cheers!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

Is this for display purposes in your DataPage or is this query going to be saved on some table? If it's the later one, I would suggest creating a task that will filter your table based on your "query" and then create a loop to generate your desired format: "RoleID: [User1], [User2]"

Link to comment
Share on other sites

  • 0

Hello @NontechnicalAdam,

You can add a Calculated Field in the Report and use this formula:

'Role ID:' + (SELECT ABC = STUFF((SELECT ', ' + CAST(USER AS nvarchar) FROM TABLENAME WHERE ID = target.[@field:ID] FOR XML PATH ('')), 1, 1, ''))

 

Please note to change the highlighted words based on the correct field names and Table Name. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...