Duplicate Rows in Query

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
btd
Posts: 324
Joined: Fri May 13, 2005 1:50 pm

Duplicate Rows in Query

Post by btd » Tue Nov 20, 2012 10:27 am

I have written a custom query which shows who has access to what repository in Vault.

For some unknow reason to me, a few users are showing 2 lines for the same repository.

I have launched the Admin tool but can't seem to figure out why its doing this.
User Repo R C A
Motakef Extranet Y N N
Extranet Y Y Y

Canyou tell me how I can fix this.

Here is my SQL
USE sgvault
SELECT DISTINCT
sgmaster..users.name,
tblrepositories.name AS Repository,
CASE WHEN tblsecurityassignments.securityrights = 1
OR tblsecurityassignments.securityrights = 3
OR tblsecurityassignments.securityrights = 7 THEN 'Y' ELSE 'N' END AS ReadRights, CASE WHEN tblsecurityassignments.securityrights = 3
OR tblsecurityassignments.securityrights = 7 THEN 'Y' ELSE 'N' END AS CheckOutInRights,
CASE WHEN tblsecurityassignments.securityrights = 7 THEN 'Y' ELSE 'N' END AS AddRemoveDeleteRights
FROM
tblsecurityassignments
INNER JOIN sgmaster..users ON tblsecurityassignments.userid = sgmaster..users.userid
INNER JOIN tblrepositories ON tblsecurityassignments.repid = tblrepositories.repid
WHERE sgmaster..users.active = 1 AND (tblsecurityassignments.securityrights <> 0)
ORDER BY sgmaster..users.name, Repository

btd
Posts: 324
Joined: Fri May 13, 2005 1:50 pm

Re: Duplicate Rows in Query

Post by btd » Tue Nov 20, 2012 1:21 pm

I figured it out. Someone went int Vault Admin tool and "Directly assigned" the user to a repository that he already had access to. This is why there were more than one line item for same user despite the Select DISTINCT clause.

THis issue is now closed.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Duplicate Rows in Query

Post by Beth » Wed Nov 21, 2012 9:45 am

Thank you for providing an update.
Beth Kieler
SourceGear Technical Support

Post Reply