Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.
Endpoint Management Community Blog

Understanding the ResourceAssociation table

Created: 08 Feb 2014 • 1 comment
SK's picture
+4 4 Votes
Login to vote

The following query maps item names to the three different guids found within the ResourceAssociation table, allowing you to understand its contents better:

SELECT
vi1.[Guid] AS ResourceAssociatiopnTypeGuid,vi1.Name AS ResourceAssociatiopnType,
vi2.[Guid] AS ParentResourceGuid,vi2.Name AS ParentResource,
vi3.[Guid] AS ChildResourceGuid,vi3.Name AS ChildResource
FROM vItem vi1
JOIN ResourceAssociation ra ON ra.ResourceAssociationTypeGuid = vi1.[Guid]
JOIN vItem vi2 ON vi2.[Guid] = ra.ParentResourceGuid
JOIN vItem vi3 ON vi3.[Guid] = ra.ChildResourceGuid
ORDER BY vi1.Name ASC

Comments 1 CommentJump to latest comment

Tomasz Wozniak's picture

Very nice query. Thanks to it I understand better the relationships between resources and can create better queries.

0
Login to vote