';             array_push($sql_arr, 'SELECT itemid,' . $calc_field . ' AS i,' .                     'SUM(num) AS count,AVG(value_avg) AS avg,MIN(value_min) AS min,' .                     'MAX(value_max) AS max,MAX(clock) AS clock' .                     ' FROM trends' .                     ' WHERE itemid=' . $itemInfo['itemid'] .                     ' AND clock>=' . $from_time .                     ' AND clock<=' . $to_time .                     ' GROUP BY itemid,' . $calc_field                     , 'SELECT itemid,' . $calc_field . ' AS i,' .                     'SUM(num) AS count,AVG(value_avg) AS avg,MIN(value_min) AS min,' .                     'MAX(value_max) AS max,MAX(clock) AS clock' .                     ' FROM trends_uint ' .                     ' WHERE itemid=' . $itemInfo['itemid'] .                     ' AND clock>=' . $from_time .                     ' AND clock<=' . $to_time .                     ' GROUP BY itemid,' . $calc_field             );         