title: How to fetch records from mysql database in sorted order with pagination along with group by status
body: <p>I have one table e.g. <code>Employee</code>, which has columns <code>(id, name, is_active)</code>.</p>
  <p>I want to fetch the records from <code>employee</code> table sorted by <code>name</code> along with pagination.</p>
  <pre><code>SELECT * from employee ORDER BY name ASC LIMIT 5, 10;
  </code></pre>
  <p>In above query <code>5</code> count to <code>skip</code> first 5 records and take next <code>10</code> records.</p>
  <p>I want to make a query which will return all records which has value <code>is_active=1</code>, followed by records which has value <code>is_active = 0</code> with pagination.</p>
  <p><strong>e.g:</strong> I have 50 records out of them 40 records has value <code>is_active=1</code>, and 10 records which has value <code>is_active=0</code>.
  So as I am using pagination and page size is suppose <code>10 records per page</code>.</p>
  <p>So query will return all <strong>active records</strong> first with order by <strong>name</strong> and at last page will return 10 <strong>inactive</strong> records order by name.</p>
  <p>Does anyone have any suggestions? Any help would be greatly appreciated.</p>
  <p>Thank you!</p>