Help with SCCM Report Query

We have many AD Groups that control folder redirection and I am wanting to report if the users are in that group to show redirected else show not redirected if they are not in that group but I am getting both results... What would I need to change to get this to show 1 or the other?

SELECT DISTINCT
CASE
   WHEN UGN.User_Group_Name0 LIKE '%DOMAIN\Users01' THEN 'Redirected'
   WHEN UGN.User_Group_Name0 LIKE '%DOMAIN\Users02' THEN 'Redirected'
ELSE 'NOT Redircted'
END AS [Redirected]
FROM  dbo.v_RA_User_UserGroupName UGN
INNER JOIN dbo.v_R_User US ON UGN.ResourceID = US.ResourceID
 
WHERE US.Full_User_Name0 LIKE '%whateverusernameis%'


September 1st, 2015 4:04pm

Your problem is user belong to more than one group. Therefore the will get redirect for the right groups and not for all other groups.

Therefore you need to use a subselect query. Search my blog for examples on how to do that.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 6:13pm

I am barley a SQL HACK... having issues figuring this out :-(  I am trying to figure this out via your blog :-(
September 2nd, 2015 10:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics