Hi everyone;
I have table contains question and answer columns , the answer either yes or no
, I want to count the answer yes and answer no then compare the two results and if the count(answer) yes is greater than count (answer) no print yes
else print no
I have wrote the following code, and I got no results
<%
jmm.Database database = new jmm.Database(pageContext.getServletContext().getRealPath("/WEB-INF/config.txt"));
database.jdbcConnect();
String sqlS , sqlD, sqlNu;
sqlS = "select count(answer) from useranswers where answer =’Yes’ ";
sqlD= "select count(answer) from useranswers where answer =’No’ ”;
int yes = Integer.parseInteger(database.jdbcOneRowQuery(sqlS));
int no= Integer.parseInteger(database.jdbcOneRowQuery(sqlD));
if(yes.get(0)> no.get(0) ){
for(int j=0;j<1;j++){
out.print("yes");
}
}
else{
out.print("no");
}
database.jdbcConClose();
database = null;
%>