In the below SQL,
SELECT a.No, a.Group, b.Code,
COALESCE(ExtractValue(a.attributes,'/Attributes/Map/entry[@key="ABC"]/@value’), "N/A") as value
from report as a join codevalue as b on a.No = b.No
for the value column, I'm passing the value of ABC to the key to retrieve the values from XML. How can I pass an SQL to the key instead of ABC and the return value from SQL will be the key.