$tech = mysql_query("SELECT SUM(`rt`.`sum`) ".
" FROM `tech` AS `t` ".
" INNER JOIN `remont_tech` AS `rt` ON `t`.`id` = `rt`.`tech_id` ".
" WHERE `t`.`tech_cat` = '".mysql_real_escape_string($cat_id)."' ".
" AND `t`.`status` = 'normal'");
if ($techs = mysql_fetch_array($tech))
$summa = $techs[0];