title: How to select xml data based on a condition in SQL
body: <p>Below is my xml</p>
  
  <pre><code>DECLARE @myDoc xml
  DECLARE @ProdID int
  SET @myDoc = 
  '&lt;Root&gt;
  &lt;ProductDescription&gt;
  &lt;ProductID&gt;1&lt;/ProductID&gt;
  &lt;ProductName&gt;Road Bike&lt;/ProductName&gt;
  &lt;GenID&gt;0C866AE2-7AAA-474F-8794-7538986268AE&lt;/GenID&gt;
  &lt;VocID&gt;AF05E961-9BC3-4249-A4A7-C6146D6FC614&lt;/VocID&gt;
  &lt;Features&gt;
    &lt;Warranty&gt;1 year parts and labor&lt;/Warranty&gt;
    &lt;Maintenance&gt;3 year parts and labor extended maintenance is available&lt;/Maintenance&gt;
  &lt;/Features&gt;
  &lt;/ProductDescription&gt;
  &lt;ProductDescription&gt;
  &lt;ProductID&gt;2&lt;/ProductID&gt;
  &lt;ProductName&gt;Road Bike2&lt;/ProductName&gt;
  &lt;GenID&gt;D1DCAD29-08C6-401E-9A0A-2130DC5D8CD4&lt;/GenID&gt;
  &lt;VocID&gt;AF05E961-9BC3-4249-A4A7-C6146D6FC614&lt;/VocID&gt;
  &lt;Features&gt;
    &lt;Warranty&gt;2 year parts and labor&lt;/Warranty&gt;
    &lt;Maintenance&gt;4 year parts and labor extended maintenance is available&lt;/Maintenance&gt;
  &lt;/Features&gt;
  &lt;/ProductDescription&gt;
  &lt;/Root&gt;'
  SET @ProdID =  @myDoc.value('(/Root/ProductDescription/ProductID)[2]', 'int' )
  SELECT @ProdID
  </code></pre>
  
  <p>This will give me the ID for second item. If I change 
  I have the <code>GenID</code> and <code>VocID</code>. Using that I need to query and get the other data.
  Kindly help me to generate query for the same.I am using SQL Server 2012. Thanks in advance.</p>