Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change Row Display Format

Author  Topic 

dhinasql
Posting Yak Master

195 Posts

Posted - 2012-09-03 : 06:56:11
Friends,

I have 3 tables and using below Query i am Getting outout for "Actions" and "SubActions" of Users. But i want to change the display order.

Example : I am using the below Query


SELECT UA.ActionID,SA.SubActionID , A.Actions , SA.SubActions
FROM UserAssociation UA
JOIN Actions A ON A.ActionID = UA.ActionID
JOIN SubAction SA ON SA.ActionID = UA.ActionID
WHERE UA.UserID = 2

Result :

1 1 Action 1 Sub Action 1 of Action 1
1 3 Action 1 Sub Action 2 of Action 1
2 5 Action 2 Sub Action 1 of Action 2

In my above query there is a possibility for repeated action for the sub Action, But Sub Action will be always unique string.

My Expected Result :

Activity SubActionId
------------------------- ------------
Action 1 0
Sub Action 1 of Action 1 1
Sub Action 2 of Action 1 3
Action 2 0
Sub Action 1 of Action 2 5

"Action" Need to be categorised and have to assign the SubActionID as "0"

Let me know if you need more details.

Thanks.




visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-03 : 14:59:12
this is more of a presentation issue and can be easily generated by using nested containers and applying grouping over action field in reporting tools like SSRS

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -