I have a table like so. The way it works is that the billing occurs daily to make sure that accounts are current.
+------+------------+-------------+
| ID | AcctType | BillingDate |
+------+------------+-------------+
| 100 | Individual | 2020-01-01 |
| 100 | Individual | 2020-01-02 |
| 100 | Individual | 2020-01-03 |
| 101 | Group | 2020-01-01 |
| 101 | Group | 2020-01-02 |
| 101 | Individual | 2020-01-01 |
+------+------------+-------------+
What I need to find is the first and last AcctType of each plan by ID since the AcctType can change. I am using MySQL and the aggregation of select ID, AcctType, min(BillingDate) from table group by ID
won't work because AcctType will return a random value associated with the ID. How do I reliably get the latest and earliest AcctType by ID? Using version 5.6.