title: Database EAV model, record listing as per search
body: <p>I am building a dynamic application.
  I have three tables : ( EAV model style)</p>
  
  <ol>
  <li>Items ( ItemId, ItemName)  </li>
  <li>Fields (FieldId, FieldName)  </li>
  <li>Field Values ( ItemID, FieldId, Value)  </li>
  </ol>
  
  <p>Can you tell me how to write SINGLE query to get starting 20 records from ALL items where FieldId=4 is equal to TRUE.  </p>
  
  <p>Expected Result :   </p>
  
  <pre><code>Columns =&gt;  ItemID | Name  | Field1 | Field2 |  Field3  
  Each Row=&gt;  ItemId | ItemName| Value1 | Value2 | Value3
  </code></pre>
  
  <p>Important concerns :   </p>
  
  <ol>
  <li>Number of fields per item are not known  </li>
  <li>I need one to write ONE query.  </li>
  <li>Query will be running on 100K records, so performance is concern.</li>
  <li>I am using MySQL 5.0, so need solution for MYSQL</li>
  </ol>
  
  <p>Should I denormalize the tables if above query is not possible at all ? Any advice ?</p>