考两段给你看看啦!
sql.add('select a.KEY key,sum(b.fee) fee'+
' from std.yellow_page_ad_ht a,std.yellow_page_ad_ad b' +
' where b.ht_no=a.ht_no(+) and b.hb_no||b.hb_no2=''2000'+s+''''+
' and a.key<>''0000000000'' and b.fee<>0 '+
' group by a.key'+
' order by fee');
qry6.SQL.Add('select hb_no||hb_no2||hb_no3 hb,count(*) count,sum(fee) fee'+
' from std.yellow_page_ad_ad '+
' where (substr(tel,1,1)<>''0'' or substr(tel,1,3)=''021'' or tel is null)'+
' and substr(dept,1,4)<>''5060'''+
' and hb_no='''+t+''' and adv_type in (''31'',''32'',''33'',''34'',''35'',''36'')'+
' and hb_no2 in ('+s+')'+
' group by hb_no||hb_no2||hb_no3');
明白啦吗?