SELECT cpn.number,type.description as type_name,coalesce(sum(duration)::numeric(8,1),0) as duration,coalesce(sum(billed)::numeric(8,2),0) as billed FROM inv_detail,type,cpn WHERE invoice=n and type.id=type_id and cpn_id=cpn.id GROUP BY type_name, cpn.number + SELECT type,description,billed FROM feature WHERE number=n = ? whatever i try gets spit back from postgres SELECT cpn.number,type.description as type_name,coalesce(sum(duration)::numeric(8,1),0) as duration,coalesce(sum(billed)::numeric(8,2),0) as billed, feature.type as feat_type, feature.description as feat_desc, feature.billed as feat_billed FROM inv_detail,type,cpn,feature WHERE invoice=n and type.id=type_id and cpn_id=cpn.id and feature.number=cpn.number GROUP BY type_name, cpn.number