Hi, I would like to implement this jsp code in a program jsp which generate Japer Report. I have 3 selects and I don't know how to implement, how to use cycles, etc. Any ideas? Maybe I need to use subreports. Thank you, Mihaela <% String Text_intrebare = " "; for (int j = 0; j < CodIntrebare.length; j++) { String Intrebare = CodIntrebare[j]; int i = 0; int flag = 0; if (j != 0) { String sql2 = "select * from item where code = " + Intrebare + "and code_survey = " + 33; java.sql.ResultSet rs2 = dataRequest.executeQuery(sql2); rs2.next(); Text_intrebare = rs2.getString(6); out.println("Intrebarea: "); out.println(Text_intrebare);%><%out.println (" Optiuni"); } String sql1 = "select * from optiune where code_item = " + Intrebare + " and code_survey = " + 33; java.sql.ResultSet rs_survey1 = dataRequest1.executeQuery(sql1); while (rs_survey1.next()) { i = 0; String Optiune = rs_survey1.getString(4); Optiune = Optiune.substring(0, Optiune.length() - 1); for (int r = 0; r < CodRegiune.length; r++) { String Regiune = CodRegiune[r]; for (int c = 0; c < CodCompanie.length; c++) { String Companie = CodCompanie[c]; for (int v = 0; v < CodVechime.length; v++) { String Vechime = CodVechime[v]; for (int f = 0; f < CodFunctie.length; f++) { String Functie = CodFunctie[f]; String sql = "select r.progressive from result_detail s, result_detail r, result_detail d, result_detail u, result_detail t where (r.progressive = d.progressive) and (s.progressive = r.progressive) and (d.progressive = u.progressive) and (u.progressive = t.progressive) and (s.code_item = " + Intrebare + ") and (substr(s.item_value_text, 0, length(s.item_value_text) - 1) = " +"'" + Optiune + "'" +") and (substr(r.item_value_text, 0, length(r.item_value_text) - 1) = " +"'" + Regiune + "')" + "and (substr(d.item_value_text, 0, length(d.item_value_text) - 1) = " + "'" + Companie +"')" + " and (substr(u.item_value_text, 0, length(u.item_value_text) - 1) = " + "'" + Vechime + "')" + " and (substr(t.item_value_text, 0, length(t.item_value_text) - 1) = " + "'" + Functie + "') and r.code_survey = 33 "; java.sql.ResultSet rs_survey = dataRequest.executeQuery(sql); while (rs_survey.next()) {i=i+1;}; } // de la Functie } // de la Vechime } // de la Companie } // de la Regiune %> <% out.println(Optiune); out.println(" " + i); %> <% } // de la while de la Optiuni %> <% } dataRequest.close(); } catch(Exception exceptie){} %>