title: SELECT with amount of all rows of associated table and join this rows. MySQL
body: <p>I have 2 tables in MySQL:</p>
  <p><strong>Table A</strong></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  </tr>
  <tr>
  <td>2</td>
  </tr>
  <tr>
  <td>3</td>
  </tr>
  <tr>
  <td>...</td>
  </tr>
  <tr>
  <td>100</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p><strong>Table B</strong></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>boolean</th>
  <th>table_a_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>3</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>...</td>
  <td>...</td>
  <td>...</td>
  </tr>
  <tr>
  <td>5300</td>
  <td>1</td>
  <td>100</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Table.A has many Table.B.</p>
  <p>So i want to SELECT 3 rows from Table.A with additional field in which amount of all associated B rows is calculated, but SELECT from A only which have 100 or more rows in B (ORDER by total_b_rows DESC LIMIT 3) and also all associated rows in B should have at least 85% of true value in boolean column. And amount of joined B rows should be 5.</p>
  <p><strong>Result</strong></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>total_b_rows</th>
  <th>table_b.id</th>
  <th>table_b.boolean</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>...</td>
  <td>...</td>
  <td>...</td>
  <td>...</td>
  </tr>
  <tr>
  <td>3</td>
  <td>1</td>
  <td>100</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p><strong>Total rows: 15</strong></p>
  <p>Help please!</p>