In SQL I am trying to group these values into single events, so that table 1 results in table 2.
Table 1
| id | Value |
| — | — |
| 1 | 0 |
| 2 | 1 |
| 3 | 2 |
| 4 | 3 |
| 5 | 0 |
| 6 | 1 |
| 7 | 2 |
| 8 | 3 |
| 9 | 4 |
| 10 | 5 |
| 11 | 0 |
| 12 | 1 |
| 13 | 2 |
| 14 | 3 |
| 15 | 4 |
| 16 | 5 |
| 17 | 6 |
| 18 | 0 |
Table 2
max(id),min(id) | Max(Value),Min(Value) |
---|---|
(4,2) | (3,1) |
(10,6) | (5,1) |
(17,12) | (6,1) |
Unsure how to do this, so any assistance would be greatly appreciated, thanks in advance.
pythonj is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.