1. 增加帐户记录: spool/home/mocsa/subsid_addmoney1.csv select t.subsid,t.acctid,sum(t.transmoney) from T_ACCTWATER t where(trunc(t.TRANSTIME,'dd')betweentrunc(to_date('20070929','yyyymmdd'),'dd')andtrunc(to_date('20071016','yyyymmdd'),'dd')) and t.TRANSTYPE = 11 and t.REPENISHCHANNEL ='307' and t.subsid in(select SubsId from T_ACCTWATER where(trunc(TRANSTIME,'dd')betweentrunc(to_date('20070929','yyyymmdd'),'dd') andtrunc(to_date('20071016','yyyymmdd'),'dd')) and TRANSTYPE = 11 and REPENISHCHANNEL ='307' groupby SubsId havingsum(TRANSMONEY)>10000) groupby t.subsid,t.acctid; spooloff;