I'm building a group view to use in Excel PowerPivot with Group data.

I want to include several group AttributeValue.Value items whose value is in guid form, so I'm linking to definedvalue.value but the attributevalue table stores the info without {} and the definedvalue table stores the info with {}.

Here is my select statement.   I get a error message that the join is not working.  I've tried is several ways, with and without the Concat to add the { }.  Is there a better way?


SELECT

 G.Id,

 (SELECT [dbo].[DefinedValue].[Value] FROM [DefinedValue] INNER JOIN [dbo].[AttributeValue] ON CONCAT ('{',[dbo].[AttributeValue].[Value],'}') = [dbo].[DefinedValue].[Guid] WHERE [dbo].[DefinedValue].[DefinedTypeID] = 72 AND [dbo].[AttributeValue].[EntityID] = G.Id) AS Age 

FROM

 [Group] G

WHERE

 G.GroupTypeId = 45

 AND G.ParentGroupId = 28957

GROUP BY

 G.Id