I am trying to built a PHP page with an HTML table that will populate the outcome of this query. Note that the values i want to split into multiple columns are all in the same column originally.... "lastvalue" this is what makes it difficult to write "ONE" query that will output my desired results.
Table Layout:
name | key_ | lastvalue
Active Calls per T1 SL5/DI1 | activeChannels[33] | 1
Active Calls per T1 SL5/DI2 | activeChannels[34] | 1
Active Calls per T1 SL5/DI3 | activeChannels[35] | 2
Active Calls per T1 SL5/DI4 | activeChannels[36] | 1
Active Calls per T1 SL5/DI5 | activeChannels[37] | 2
Active Calls per T1 SL5/DI6 | activeChannels[38] | 1
Active Calls per T1 SL5/DI7 | activeChannels[39] | 0
Active Calls per T1 SL5/DI8 | activeChannels[40] | 0
Active Calls per T1 SL6/DI1 | activeChannels[41] | 0
Active Calls per T1 SL6/DI2 | activeChannels[42] | 0
Active Calls per T1 SL6/DI3 | activeChannels[43] | 0
Active Calls per T1 SL6/DI4 | activeChannels[44] | 0
Active Calls per T1 SL6/DI5 | activeChannels[45] | 0
Active Calls per T1 SL6/DI6 | activeChannels[46] | 0
Active Calls per T1 SL6/DI7 | activeChannels[47] | 0
Active Calls per T1 SL6/DI8 | activeChannels[48] | 0
Active Calls per T1 SL7/DI1 | activeChannels[49] | 23
Active Calls per T1 SL7/DI2 | activeChannels[50] | 1
Active Calls per T1 SL7/DI3 | activeChannels[51] | 0
Active Calls per T1 SL7/DI4 | activeChannels[52] | 9
Active Calls per T1 SL7/DI5 | activeChannels[53] | 0
Active Calls per T1 SL7/DI6 | activeChannels[54] | 2
Active Calls per T1 SL7/DI7 | activeChannels[55] | 0
Active Calls per T1 SL7/DI8 | activeChannels[56] | 0
Active Calls per T1 SL8/DI1 | activeChannels[57] | 0
Active Calls per T1 SL8/DI2 | activeChannels[58] | 0
Active Calls per T1 SL8/DI3 | activeChannels[59] | 0
Active Calls per T1 SL8/DI4 | activeChannels[60] | 0
Active Calls per T1 SL8/DI5 | activeChannels[61] | 0
Active Calls per T1 SL8/DI6 | activeChannels[62] | 0
Active Calls per T1 SL8/DI7 | activeChannels[63] | 0
Active Calls per T1 SL8/DI8 | activeChannels[64] | 0
Active Calls per T1 Totals: | activeChannels[999 | 42
DS1 Datalink layer Status (L2) SL5/DI1 | statusLayer2[33] | Active
DS1 Datalink layer Status (L2) SL5/DI2 | statusLayer2[34] | Active
DS1 Datalink layer Status (L2) SL5/DI3 | statusLayer2[35] | Active
DS1 Datalink layer Status (L2) SL5/DI4 | statusLayer2[36] | Active
DS1 Datalink layer Status (L2) SL5/DI5 | statusLayer2[37] | Active
DS1 Datalink layer Status (L2) SL5/DI6 | statusLayer2[38] | Active
DS1 Datalink layer Status (L2) SL5/DI7 | statusLayer2[39] | Active
DS1 Datalink layer Status (L2) SL5/DI8 | statusLayer2[40] | Active
DS1 Datalink layer Status (L2) SL6/DI1 | statusLayer2[41] | Active
DS1 Datalink layer Status (L2) SL6/DI2 | statusLayer2[42] | Awaiting Establishment
DS1 Datalink layer Status (L2) SL6/DI3 | statusLayer2[43] | Active
DS1 Datalink layer Status (L2) SL6/DI4 | statusLayer2[44] | Active
DS1 Datalink layer Status (L2) SL6/DI5 | statusLayer2[45] | Active
DS1 Datalink layer Status (L2) SL6/DI6 | statusLayer2[46] | Active
DS1 Datalink layer Status (L2) SL6/DI7 | statusLayer2[47] | Active
DS1 Datalink layer Status (L2) SL6/DI8 | statusLayer2[48] | Active
DS1 Datalink layer Status (L2) SL7/DI1 | statusLayer2[49] | Active
DS1 Datalink layer Status (L2) SL7/DI2 | statusLayer2[50] | Active
DS1 Datalink layer Status (L2) SL7/DI3 | statusLayer2[51] | Active
DS1 Datalink layer Status (L2) SL7/DI4 | statusLayer2[52] | Active
DS1 Datalink layer Status (L2) SL7/DI5 | statusLayer2[53] | Awaiting Establishment
DS1 Datalink layer Status (L2) SL7/DI6 | statusLayer2[54] | Active
DS1 Datalink layer Status (L2) SL7/DI7 | statusLayer2[55] | Active
DS1 Datalink layer Status (L2) SL7/DI8 | statusLayer2[56] | Active
DS1 Datalink layer Status (L2) SL8/DI1 | statusLayer2[57] | Active
DS1 Datalink layer Status (L2) SL8/DI2 | statusLayer2[58] | Active
DS1 Datalink layer Status (L2) SL8/DI3 | statusLayer2[59] | Active
DS1 Datalink layer Status (L2) SL8/DI4 | statusLayer2[60] | Active
DS1 Datalink layer Status (L2) SL8/DI5 | statusLayer2[61] | Active
DS1 Datalink layer Status (L2) SL8/DI6 | statusLayer2[62] | Active
DS1 Datalink layer Status (L2) SL8/DI7 | statusLayer2[63] | Active
DS1 Datalink layer Status (L2) SL8/DI8 | statusLayer2[64] | Active
DS1 Datalink layer Status (L2) Totals: | statusLayer2[999] | 30 Active
DS1 Physical layer Status (L1) SL5/DI1 | statusLayer1[33] | Active
DS1 Physical layer Status (L1) SL5/DI2 | statusLayer1[34] | Active
DS1 Physical layer Status (L1) SL5/DI3 | statusLayer1[35] | Active
DS1 Physical layer Status (L1) SL5/DI4 | statusLayer1[36] | Active
DS1 Physical layer Status (L1) SL5/DI5 | statusLayer1[37] | Active
DS1 Physical layer Status (L1) SL5/DI6 | statusLayer1[38] | Active
DS1 Physical layer Status (L1) SL5/DI7 | statusLayer1[39] | Active
DS1 Physical layer Status (L1) SL5/DI8 | statusLayer1[40] | Active
DS1 Physical layer Status (L1) SL6/DI1 | statusLayer1[41] | Active
DS1 Physical layer Status (L1) SL6/DI2 | statusLayer1[42] | Lost Framing
DS1 Physical layer Status (L1) SL6/DI3 | statusLayer1[43] | Active
DS1 Physical layer Status (L1) SL6/DI4 | statusLayer1[44] | Active
DS1 Physical layer Status (L1) SL6/DI5 | statusLayer1[45] | Active
DS1 Physical layer Status (L1) SL6/DI6 | statusLayer1[46] | Active
DS1 Physical layer Status (L1) SL6/DI7 | statusLayer1[47] | Active
DS1 Physical layer Status (L1) SL6/DI8 | statusLayer1[48] | Active
DS1 Physical layer Status (L1) SL7/DI1 | statusLayer1[49] | Active
DS1 Physical layer Status (L1) SL7/DI2 | statusLayer1[50] | Active
DS1 Physical layer Status (L1) SL7/DI3 | statusLayer1[51] | Active
DS1 Physical layer Status (L1) SL7/DI4 | statusLayer1[52] | Active
DS1 Physical layer Status (L1) SL7/DI5 | statusLayer1[53] | Lost Framing
DS1 Physical layer Status (L1) SL7/DI6 | statusLayer1[54] | Active
DS1 Physical layer Status (L1) SL7/DI7 | statusLayer1[55] | Active
DS1 Physical layer Status (L1) SL7/DI8 | statusLayer1[56] | Active
DS1 Physical layer Status (L1) SL8/DI1 | statusLayer1[57] | Active
DS1 Physical layer Status (L1) SL8/DI2 | statusLayer1[58] | Active
DS1 Physical layer Status (L1) SL8/DI3 | statusLayer1[59] | Active
DS1 Physical layer Status (L1) SL8/DI4 | statusLayer1[60] | Active
DS1 Physical layer Status (L1) SL8/DI5 | statusLayer1[61] | Active
DS1 Physical layer Status (L1) SL8/DI6 | statusLayer1[62] | Active
DS1 Physical layer Status (L1) SL8/DI7 | statusLayer1[63] | Active
DS1 Physical layer Status (L1) SL8/DI8 | statusLayer1[64] | Active
DS1 Physical layer Status (L1) Totals: | statusLayer1[999] | 30 Active
Framing Errors per T1 SL5/DI1 | frameErrors[33] | 22
Framing Errors per T1 SL5/DI2 | frameErrors[34] | 62
Framing Errors per T1 SL5/DI3 | frameErrors[35] | 64
Framing Errors per T1 SL5/DI4 | frameErrors[36] | 66
Framing Errors per T1 SL5/DI5 | frameErrors[37] | 57
Framing Errors per T1 SL5/DI6 | frameErrors[38] | 59
Framing Errors per T1 SL5/DI7 | frameErrors[39] | 66
Framing Errors per T1 SL5/DI8 | frameErrors[40] | 64
Framing Errors per T1 SL6/DI1 | frameErrors[41] | 68
Framing Errors per T1 SL6/DI2 | frameErrors[42] | 68
Framing Errors per T1 SL6/DI3 | frameErrors[43] | 65
Framing Errors per T1 SL6/DI4 | frameErrors[44] | 75
Framing Errors per T1 SL6/DI5 | frameErrors[45] | 64
Framing Errors per T1 SL6/DI6 | frameErrors[46] | 69
Framing Errors per T1 SL6/DI7 | frameErrors[47] | 68
Framing Errors per T1 SL6/DI8 | frameErrors[48] | 58
Framing Errors per T1 SL7/DI1 | frameErrors[49] | 194
Framing Errors per T1 SL7/DI2 | frameErrors[50] | 196
Framing Errors per T1 SL7/DI3 | frameErrors[51] | 185
Framing Errors per T1 SL7/DI4 | frameErrors[52] | 180
Framing Errors per T1 SL7/DI5 | frameErrors[53] | 0
Framing Errors per T1 SL7/DI6 | frameErrors[54] | 199
Framing Errors per T1 SL7/DI7 | frameErrors[55] | 59
Framing Errors per T1 SL7/DI8 | frameErrors[56] | 66
Framing Errors per T1 SL8/DI1 | frameErrors[57] | 28
Framing Errors per T1 SL8/DI2 | frameErrors[58] | 47
Framing Errors per T1 SL8/DI3 | frameErrors[59] | 43
Framing Errors per T1 SL8/DI4 | frameErrors[60] | 41
Framing Errors per T1 SL8/DI5 | frameErrors[61] | 48
Framing Errors per T1 SL8/DI6 | frameErrors[62] | 42
Framing Errors per T1 SL8/DI7 | frameErrors[63] | 47
Framing Errors per T1 SL8/DI8 | frameErrors[64] | 45
Framing Errors per T1 Totals: | frameErrors[999] | 2415
And here is the outcome I would like:
port | layer1 | layer2 | freaming_errors | active_calls
T1 SL5/DI1 | Active | Active | 22 | 1
T1 SL5/DI2 | Active | Active | 62 | 1
T1 SL5/DI3 | Active | Active | 64 | 2
T1 SL5/DI4 | Active | Active | 66 | 1
T1 SL5/DI5 | Active | Active | 57 | 2
T1 SL5/DI6 | Active | Active | 59 | 1
T1 SL5/DI7 | Active | Active | 66 | 0
T1 SL5/DI8 | Active | Active | 64 | 0
T1 SL6/DI1 | Active | Active | 68 | 0
T1 SL6/DI2 | Lost Framing | Awaiting Establishment | 68 | 0
T1 SL6/DI3 | Active | Active | 65 | 0
T1 SL6/DI4 | Active | Active | 75 | 0
T1 SL6/DI5 | Active | Active | 64 | 0
T1 SL6/DI6 | Active | Active | 69 | 0
T1 SL6/DI7 | Active | Active | 68 | 0
T1 SL6/DI8 | Active | Active | 58 | 0
T1 SL7/DI1 | Active | Active | 194 | 23
T1 SL7/DI2 | Active | Active | 196 | 1
T1 SL7/DI3 | Active | Active | 185 | 0
T1 SL7/DI4 | Active | Active | 180 | 9
T1 SL7/DI5 | Lost Framing | Awaiting E
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…