title: In this table structure, how to search for articles by field values?
body: <p>Among the joomla tables there are these three tables, <strong>content</strong> that stores the articles, <strong>fields</strong> that stores the definition of custom fields and <strong>fields_values</strong> that stores the values assigned to these custom fields in articles.</p>
  
  <p>Here the table definitions with some of their fields</p>
  
  <pre><code>content
  -------------
    id
    title
  
  fields
  -------------
    id
    title
    name
  
  fields_values
  -------------
    field_id &lt;-- field_id refer to content id
    item_id
    value
  </code></pre>
  
  <p>I need to search content records for the values in field_values, but I don't know how to do it</p>
  
  <p>For convenience I created this <a href="http://sqlfiddle.com/#!9/26e0cb" rel="nofollow noreferrer">sqlfiddle</a> </p>
  
  <p>The <a href="http://sqlfiddle.com/#!9/aa4318" rel="nofollow noreferrer">sqlfiddle</a> with the value target </p>
  
  <p>Given the sqlfiddle sample data I need to search for the articles (content records) where any of the fields have the value <code>target</code></p>
  
  <p>The expected results would be the article with id 1 because in <code>field1</code> of article 1 has the value <code>target</code> and the article with id 3 because in <code>field2</code> of article 3 has the value <code>target</code></p>
  
  <p>I appreciate your advice...</p>