Используйте Sum
агрегатную функцию с оператором case, как показано ниже, если вы хотите, чтобы сумма этих значений t.value основывалась на t.clock, затем сгруппируйте их по этому столбцу, чтобы получить часы, а сумму значений.
select sum(case when i.hostid='223344' and t.itemid = '0223344' then t.value end) as FirstValue,sum(case when i.hostid='112233' and t.itemid = '0112233' then t.value end) as SecondValue
from hosts h, items i,history_uint t
where i.hostid=h.hostid and t.itemid=i.itemid
Если он основан на t.clock, то
select t.clock, sum(case when i.hostid='223344' and t.itemid = '0223344' then t.value end) as FirstValue,sum(case when i.hostid='112233' and t.itemid = '0112233' then t.value end) as SecondValue
from hosts h, items i,history_uint t
where i.hostid=h.hostid and t.itemid=i.itemid
group by t.clock