Hi, could someone help me, please?
I have to get two averages, and to do a calculation with them.
Average 1:
select avg(value) from
(select
datetime,
(select value from history
where tagname = 'IS_Press_Pulp_H2O'
and datetime = h.datetime) value
from history h
where tagname = 'IS_Press_Pulp_H2O_Sample' and
wwretrievalmode = 'delta' and
wwrowcount = 0 and
datetime > convert(varchar(10), getdate(), 121) + ' 00:00:00'
and
datetime < convert(varchar(10), dateadd(dd, 1, getdate()), 121) + ' 00:00:00') history
Average 2:
select avg(value) from
(select
datetime,
(select value from history
where tagname = 'IS_Feed_Wt_Pol'
and datetime = h.datetime) value
from history h
where tagname = 'IS_Feed_Wt_Pol_Ref' and
wwretrievalmode = 'delta' and
wwrowcount = 0 and
datetime > convert(varchar(10), getdate(), 121) + ' 00:00:00'
and
datetime < convert(varchar(10), dateadd(dd, 1, getdate()), 121) + ' 00:00:00') history
and with these two results:
(Average1 / Average2) * 100
Do you know how could I join it?
Thanks,
Mushu