title: How to tell if one string is contained within another text element in MySQL
body: <p>I asked this question earlier:</p>
  
  <p><a href="https://stackoverflow.com/questions/11057597/determine-how-many-characters-in-text-are-within-another-text-entry-in-mysql/11057686#11057686">How to get delta between two text items</a></p>
  
  <p>But I also need a more binary answer.  That is, is there a way to tell if one text entry contains another.   Again the example:</p>
  
  <pre><code>This is a line.
  </code></pre>
  
  <p>and</p>
  
  <pre><code>This is a line.  And another.
  </code></pre>
  
  <p>Is there a simple way in MySQL to tell the first is contained in the second?  Both of these items are entries in a column that is of type text.</p>
  
  <p>UPDATE:</p>
  
  <p>My table looks like this</p>
  
  <p>id INT,
  mytext text</p>
  
  <p>So, what I'd REALLY like to do is write a query that answers the following question:</p>
  
  <p>Find all records in this table where mytext is contained in mytext_for_another_record where id=SOMENUMBER. </p>
  
  <p>Maybe better put:
  Find all records where id=123 and mytext(for id 123) is contained in the record.</p>
  
  <p>So I'm scanning the entire table for records that contain the text for the entry where id=123.</p>
  
  <p>Example data:</p>
  
  <h2>id | text</h2>
  
  <p>1  |  this is a line
  2  |  this is a line and here is another
  3  |  random
  4  |  random this is a line</p>
  
  <p>Now, rather than short text entries, suppose the text was VERY long, like 1000 characters.  Suppose I wanted to find all records in the database that contained the text that was in record 1.  Is the only way to do so to say <code>LIKE '%this is a line%'</code> ?  Is there a way to look by giving the id of the record?  </p>