title: XPath get value of attribute 'A' based on attribute 'B' in SQL Server xml
body: <p>I have this XML in SQL Server</p>
  
  <pre><code>&lt;data&gt;
  &lt;add key="images" value="image/path/img.gif" /&gt;
  &lt;data&gt;
  </code></pre>
  
  <p>I want to select the value attribute of every "add" node with key = "images"</p>
  
  <p>What i have now is: </p>
  
  <pre><code>SELECT ID, Data from Items 
  where Data.value('(//data/add[@key="images"]/@value)[1]', 'nvarchar') Like '%img%'
  </code></pre>
  
  <p>Any suggestions?</p>