title: How to query the index for each record based on timestamp
body: <p>I have a order table which i would like to index each company's first second third ... etc order. </p>
  
  <p>Example of table:</p>
  
  <pre><code>|---------------------|--------------------------|
  |      company_id     |     created_at           |
  |---------------------|--------------------------|
  |          1          |   2019-01-01 01:00:00    |
  |---------------------|--------------------------|
  |          1          |   2019-02-01 01:00:00    |
  |---------------------|--------------------------|
  |          2          |   2019-03-01 02:00:00    |
  |---------------------|--------------------------|
  |          3          |   2019-03-01 08:30:00    |
  |---------------------|--------------------------|
  |          2          |   2019-03-01 10:00:00    |
  |---------------------|--------------------------|
  </code></pre>
  
  <p>I Would it be queried like this in the end. but im not sure how..... i keep going back to counting and grouping the fields but i cant seem to get the sum for each row  based on the timestamp</p>
  
  <pre><code>|---------------------|--------------------------|-------|
  |      company_id     |     created_at           |count()|
  |---------------------|--------------------------|--------
  |          1          |   2019-01-01 01:00:00    |   1   |
  |---------------------|--------------------------|--------
  |          1          |   2019-02-01 01:00:00    |   2   |
  |---------------------|--------------------------|--------
  |          2          |   2019-03-01 02:00:00    |   1   |
  |---------------------|--------------------------|--------
  |          3          |   2019-03-01 08:30:00    |   1   |
  |---------------------|--------------------------|--------
  |          2          |   2019-03-01 10:00:00    |   2   |
  |---------------------|--------------------------|--------
  </code></pre>