→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎09-16-2015 10:30 AM
Solved! Go to Solution.
‎09-16-2015 01:06 PM
Select Distinct Top 1000000 tblADusers.Username,
tblADusers.Userdomain,
tblAssets.AssetID,
tblAssets.AssetName
From tblADusers
Left Join (Select tblUsersInGroup.Username,
tblUsersInGroup.Domainname,
tblUsersInGroup.AssetID
From tblUsersInGroup
Where tblUsersInGroup.Admingroup = 1) tUsersInGroupAdmin
On tblADusers.Username = tUsersInGroupAdmin.Username And
tblADusers.Userdomain = tUsersInGroupAdmin.Domainname
Left Join (Select tblUsersInGroup.AssetID,
tblADMembership.ChildAdObjectID
From tblADMembership
Inner Join tblADGroups On tblADMembership.ParentAdObjectID =
tblADGroups.ADObjectID
Inner Join tblUsersInGroup On tblUsersInGroup.Username = tblADGroups.Name
Where tblUsersInGroup.Admingroup = 1) tADgroupAdmin
On tADgroupAdmin.ChildAdObjectID = tblADusers.ADObjectID
Left Join tblAssets On tblAssets.AssetID = tUsersInGroupAdmin.AssetID Or
tblAssets.AssetID = tADgroupAdmin.AssetID
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Order By tblADusers.Username,
tblADusers.Userdomain,
tblAssets.AssetName,
tblAssets.AssetID
‎09-17-2015 11:46 AM
‎09-17-2015 09:28 AM
‎09-16-2015 02:18 PM
‎09-16-2015 01:06 PM
Select Distinct Top 1000000 tblADusers.Username,
tblADusers.Userdomain,
tblAssets.AssetID,
tblAssets.AssetName
From tblADusers
Left Join (Select tblUsersInGroup.Username,
tblUsersInGroup.Domainname,
tblUsersInGroup.AssetID
From tblUsersInGroup
Where tblUsersInGroup.Admingroup = 1) tUsersInGroupAdmin
On tblADusers.Username = tUsersInGroupAdmin.Username And
tblADusers.Userdomain = tUsersInGroupAdmin.Domainname
Left Join (Select tblUsersInGroup.AssetID,
tblADMembership.ChildAdObjectID
From tblADMembership
Inner Join tblADGroups On tblADMembership.ParentAdObjectID =
tblADGroups.ADObjectID
Inner Join tblUsersInGroup On tblUsersInGroup.Username = tblADGroups.Name
Where tblUsersInGroup.Admingroup = 1) tADgroupAdmin
On tADgroupAdmin.ChildAdObjectID = tblADusers.ADObjectID
Left Join tblAssets On tblAssets.AssetID = tUsersInGroupAdmin.AssetID Or
tblAssets.AssetID = tADgroupAdmin.AssetID
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Order By tblADusers.Username,
tblADusers.Userdomain,
tblAssets.AssetName,
tblAssets.AssetID
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now