Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9128355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:29:43+00:00 2026-06-17T07:29:43+00:00

i m trying to execute multiply function in sql but it doesnt compute d

  • 0

i m trying to execute multiply function in sql but it doesnt compute d values.
d problem is i forgt to create a total row to store the multiplied values n i cant create a new table or add d row..
here is d code i m using n d error it is displayin.
do help.

<%
try
{
   Class.forName("com.mysql.jdbc.Driver");
   Connection conexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/invent", "root", "hpdj850c");
   if (!conexion.isClosed())
   {
      Statement st = conexion.createStatement();
      ResultSet rs = st.executeQuery("select * from store");
      Statement sta = conexion.createStatement();
      ResultSet r = sta.executeQuery("select (rate*quantity) from store");

      out.println("<table class=\"twelve\"><thead><tr><th>Id</th><th>Name</th><th>Category</th><th>Rate</th><th>Quantity</th><th>Total</th></tr></thead>");
      while (rs.next() & r.next())
      {

         out.println("<tr>");
         out.println("<td>"+rs.getObject("itemno")+"</td>");
         out.println("<td>"+rs.getObject("name")+"</td>");
         out.println("<td>"+rs.getObject("category")+"</td>");
         out.println("<td>"+rs.getObject("rate")+"</td>");
         out.println("<td>"+rs.getObject("quantity")+"</td>"); 
         out.println("<td>"+r.getStatement() + "</td>");
         out.println("</tr>");

           }
      out.println("</table>");

      conexion.close();
   }
   else
      out.println("fail");
}
catch (Exception e)
{
   out.println("Exception " + e);
   e.printStackTrace();
}
%>

total:

com.mysql.jdbc.StatementImpl@3b46c4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:29:44+00:00Added an answer on June 17, 2026 at 7:29 am

    Instead of using two separate query use a single query to achieve this

    For eg:

    select            itemno ,
                      name ,
                      category ,
                      rate ,
                      quantity,
                      rate*quantity as total from Test
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m trying to execute linux commant 'cat' from java code, but it does not
I am trying to execute the following query in oracle but not able to
Im trying to create a windows service with vb.net but when I run: InstallUtil.exe
I'm trying to string concatenate multiple row values from one table using Coalesce, separated
I am trying to alter the Bash function below to execute each command argument.
Using Javascript, I'm trying to loop through an array and execute a function with
I am trying to use system function. The command that I execute return multiple
Hi I am trying to create an layered image effect but I am having
I am trying to extract some checkboxes values into an array. My problem is
In the following command i am trying to ssh commands and execute the multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.