title: check value in xml tag with sql
body: <p>I'm trying to get and check some attribute value in the xml document.
  Tag: </p>
  
  <pre><code>&lt;СведТов НомСтр="" НаимТов="" ОКЕИ_Тов="7966" КолТов="" ЦенаТов="" СтТовБезНДС="" НалСт="" СтТовУчНал=""&gt;
  &lt;/СведТов&gt;
  </code></pre>
  
  <p>I've tried next:</p>
  
  <pre><code>SELECT *
  FROM table1 a
  LEFT JOIN table2 as b ON a.intDocID=b.intDocID 
  LEFT JOIN table3 as c ON a.intDocID = c.intOneDocID
  WHERE SUBSTRING_INDEX(SUBSTRING_INDEX( CONVERT( c.varBody USING cp1251 ) , 'ОКЕИ_Тов="', -1), '"', 1) &gt; 999 and 
  SUBSTRING_INDEX(SUBSTRING_INDEX( CONVERT( c.varBody USING cp1251 ) , 'ОКЕИ_Тов="', -1), '"', 1) &lt; 10000 and
  a.intSendTimestamp &lt; UNIX_TIMESTAMP('2017-08-11 23:59:59')
  </code></pre>
  
  <p>But it isn't working.</p>