title: Error while using like statement in django raw sql
body: <p>I have a raw sql query which is always giving error while executing. Here is my query</p>
  
  <pre><code>Users.objects.raw('select target, username from users where location like \'%s%%\' and date(modified) = \'2011-06-14\'',[location])
  </code></pre>
  
  <p>I am taking the <code>location = 'BUILD'</code></p>
  
  <p>Location values would be 'BUILD_A', 'BUILD_B','BUILD_C'.</p>
  
  <p>When I am executing the raw sql, below is the error I am getting.</p>
  
  <blockquote>
    <p>DatabaseError: (1064, "You have an error in your SQL syntax; check the manual
        that corresponds to your MySQL server version for the right syntax to use near
        'BUILD'%' and date(modified) = '2011-06-14'' at line 1")</p>
  </blockquote>
  
  <p>In MySQL terms I need to execute the following query:</p>
  
  <pre><code>Select target, username from users where location like 'BUILD%' and target = '2011-06-14'
  </code></pre>
  
  <p>I have googled it but could not able to get it. Please some one help me</p>