Need help to write query to bring from 1st table and need to get as out put table
input table data | |||||
---|---|---|---|---|---|
col1 | col2 | col3 | col4 | col5 | |
1 | 21 | 12-06-2021 09:08:07 | 1 | idle | |
2 | 21 | 12-06-2021 09:08:10 | 1 | gant | |
3 | 21 | 12-06-2021 09:08:11 | 0 | gant | |
4 | 21 | 12-06-2021 09:08:17 | 1 | idle | |
5 | 21 | 12-06-2021 09:08:27 | 1 | idle | |
6 | 21 | 12-06-2021 09:08:37 | 1 | idle | |
7 | 21 | 12-06-2021 09:08:47 | 1 | idle | |
8 | 21 | 12-06-2021 09:09:47 | 1 | gan | |
9 | 21 | 12-06-2021 09:09:50 | 1 | gan | |
10 | 21 | 12-06-2021 10:08:17 | 1 | idle | |
11 | 21 | 12-06-2021 10:09:17 | 1 | idle | |
12 | 21 | 12-06-2021 10:18:17 | 1 | idle |
Output | |||
---|---|---|---|
col2 | col5 | Max_date | min_date |
21 | idle | 12-06-2021 09:08:07 | 12-06-2021 09:08:07 |
21 | gant | 12-06-2021 09:08:11 | 12-06-2021 09:08:10 |
21 | idle | 12-06-2021 09:08:47 | 12-06-2021 09:08:17 |
21 | gan | 12-06-2021 09:09:50 | 12-06-2021 09:09:47 |
21 | idle | 12-06-2021 10:18:17 | 12-06-2021 10:18:17 |
strong text