I have got a database with following data fields:-
chkey chvalue updatetime unit_id
ch1 27 7/11/2018 1:08 35
ch2 89 7/12/2018 1:08 35
ch1 26 7/13/2018 2:08 46
ch2 77 7/14/2018 2:08 46
ch1 24 7/15/2018 3:08 47
ch2 77 7/16/2018 3:08 47
ch1 28 7/11/2018 6:18 35
ch2 86 7/12/2018 6:18 35
ch1 27 7/11/2018 7:18 35
ch2 86 7/12/2018 7:18 35
ch1 27 7/11/2018 9:18 48
ch2 86 7/12/2018 9:18 48
ch3 23 7/11/2018 9:18 48
ch4 99 7/12/2018 9:18 48
.....
what i want is a query for generating a result like this:-
for unit_id = 35
updatetime ch1 ch2 unit_id
7/11/2018 1:08 27 89 35
7/11/2018 6:18 28 86 35
7/11/2018 7:18 27 86 35
for unit_id= 46
updatetime ch1 ch2 unit_id
7/11/2018 2:08 27 77 46
for unit_id=47
updatetime ch1 ch2 unit_id
7/11/2018 3:08 24 77 47
for unit_id=48
updatetime ch1 ch2 ch3 ch4 unit_id
7/11/2018 9:18 27 86 23 99 48
NOTE: chkey's can be upto ch1....ch64 for any unit_id it can be anything let's say a unit with ch5 and so on .