Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void updateCuotaTotal() throws SQLException{
- Connection con = crearConexion();
- Statement stat = con.createStatement();
- ResultSet rs = stat.executeQuery("select dni, mes, sum(cantidad) as cant from pagos group by dni, mes");
- while(rs.next()){
- String dni = rs.getString("dni");
- String mes = rs.getString("mes");
- float cantidad = rs.getFloat("cant");
- PreparedStatement ps = con.prepareStatement("INSERT INTO cuota VALUES (?, ?, ?)");
- ps.setString(1, dni);
- ps.setString(2, mes);
- ps.setFloat(3, cantidad);
- ps.execute();
- }
- con.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement