select count(unitid) as family_count, sum(jzffsum) as people_sum from unit left join ( select distinct unitid, jzfffamilyid, jzfffsum from jzff_history where jzfftime > ='2007-5-1' and jzfftime <'2007-7-1') temp on unit.unitid = temp.unitid where unitname = '青羊区' group by temp.unitid,temp.jzfffamilyid
发表于:2007-10-24 16:23:024楼 得分:0
select count(a.unitid) as family_count, sum(a.jzffsum) as people_sum from jzff_history a where a.unitid = 2 and a.jzfftime > = to_date('2007-05-01') and jzfftime < to_date('2007-07-01')