I have a order table which i would like to index each company's first second third ... etc order.
Example of table:
|---------------------|--------------------------|
| 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 |
|---------------------|--------------------------|
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
|---------------------|--------------------------|-------|
| 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 |
|---------------------|--------------------------|--------