日期:2014-05-17 浏览次数:20763 次
strSQL = "select idx from ta where type = 'xxx'"; rsA = stmtA.executeQuery(strSQL); //这里的rsA包含数万条记录 while(rsA.next()){ //这里将会是数万次循环 strSQL = "select price from tb where idx = " + rsA.getInt("idx"); rsB = stmtB.executeQuery(strSQL); while(rsB.next()){ 这里又是数万次循环 price += rsB.getInt("price"); } }
select idx,price from tb where idx in ( select idx from ta where type = XXX )