1)先是执行更新
sql = "select * from sellrequire";
stmt1 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs1 = stmt1.executeQuery(sql)
while (rs1.next()){......rs1.updateRow();}
2)接下来是从该表中选部分记录,通过while循环依次插入到另一个表中。
sql = "select id,requiresimilarity from sellrequire order by requiresimilarity desc limit 0,similarrequirenum";
stmt2 = conn.createStatement() ;
rs2 = stmt2.executeQuery(sql); //得到最相似的卖方的ID和相似度
while (rs2.next()) {...}
我起先怀疑是不是要把先前的rs1关闭,但关闭了也还是不行,不知道是什么原因?
谢谢!
mysql中,我想先对表的某些字段进行更新,然后再选出几个记录插入到另一个表中,但