How do we combine the values of several lines of the table?
-
There is a table of type:
01:00, Parameter1, Value
01:00, Parameter2, Value
01:00, Parameter3, Value
♪ ♪ ♪ ♪
0300, Parameter1, Value
0300, Parameter2, Value
0300, Parameter 3, meaning, etc.Can SQL be requested to obtain such a sample
01:00, ValueParameter1, ValueParameter2, ValueParameter3
♪ ♪ ♪
0300, ValueParameter1, ValueParameter2, ValueParameter3Thank you!
-
Probably. Something like:
select time, sum (case when parname='Параметр1' then parval else 0 end) as par1, sum (case when parname='Параметр2' then parval else 0 end) as par2, sum (case when parname='Параметр3' then parval else 0 end) as par3 from t group by time;
If there are rows with the same parameter and time, you will receive the sum (may use other aggregate functions)