Perchè vuoi proprio contare le righe prima di eseguire la seconda query?
Potresti iterare sul primo rs e contemporaneamente eseguire le altre query.
codice:
ResultSet rs_risorse=sql.executeQuery("SELECT consuntivo.id_risorsa, risorse.nome_risorsa FROM consuntivo LEFT JOIN risorse on risorse.id_risorsa=consuntivo.id_risorsa GROUP BY id_risorsa");
while(rs.next()){
int id_risorsa=rs_risorse.getInt("id_risorsa");
nome_risorsa=rs_risorse.getString("nome_risorsa");
riga_settimana=riga_settimana+"<th>"+nome_risorsa+"</th>";
//DEBUG
out.println("id_risorsa="+id_risorsa);
out.println("
"+nome_risorsa+"
");
for(int i=1;i<53;i++) {
query_consuntivo="SELECT * FROM consuntivo WHERE id_commessa='1' AND id_risorsa="+id_risorsa+" AND settimana_consuntivo="+i;
//debug
//out.println("
"+query_consuntivo);
if (i==52){
riga_tabella=riga_tabella+"<td>"+i+"</td><td>Totali</td></tr>";
}else {
riga_tabella=riga_tabella+"<td>"+i+"</td>";
}
ResultSet rs_consuntivo=sql.executeQuery(query_consuntivo);
while(rs_consuntivo.next()) {
giorni_consuntivo=rs_consuntivo.getInt("giorni_consuntivo");
riga_consuntivo=riga_consuntivo+"<tr>";
riga_consuntivo=riga_tabella+"<td>"+giorni_consuntivo+"</td>";
}
}
}
Non ho provato il codice ma secondo me risolve il tuo problema.