• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sum of the column

 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to generate the daily report , its contains fees column, here i'm getting all the fees using the while, but i'm unable to get the SUM of that column, is there any method in JSP to get the SUM.
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try the following

int fees = 0;
int total_fees =0;
while(rs.next())
{
fees = rs.getInt("fees");
total_fees = total_fees + fees;
}

out.println("The Total fees is " + total_fees);
 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rekha
Its working fine , Thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!