Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners sum database column
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Godwin
sum database column
1 Answer(s)      a year and 11 months ago
Posted in : Java Beginners


please i have two columns-col1 and col2, col1 contain item and col2 contain the quantity of the item

col1 col2 Key 4 Soap 5 seat 4 Key 3 Soap 4

how will i query the database to sum the Items and display output so that it will be like this col1 col2 Key 7 Soap 9 Seat 4

thanks


Advertisement
View Answers

January 7, 2013 at 12:59 PM


hi friend, use MySQL(group by) keyword to solve your problem. Here I am giving a sample SQL query hope this will helpful for you.

select item, sum(quqantity) from `order` group by item


Related Tutorials/Questions & Answers:
sum database column
sum database column  please i have two columns-col1 and col2, col1... 3 Soap 4 how will i query the database to sum the Items... for you. select item, sum(quqantity) from `order` group by item
Sum of Column in a Database Table
Sum of Column in a Database Table   ... to calculate the sum of specific column in database table. Here is the code of program... of specific column data in the database table. Consider an example of any
Advertisements
sum of all values in a column of jtable
sum of all values in a column of jtable  hey everyone, is there a code to display the sum of all values in a column of a jtable namely CARTtbl in a jabel without using a button,and the sum will change when an item is added
Display Sum of Table Column Using In JSP
Display Sum of Table Column Using In JSP... an application to Display the sum data of a Table column for a specific Date. We created five file sum_count.jsp, resultForm.jsp, result_count.jsp, sumcount.java
Sum database colum in java
Sum database colum in java  please i have two columns-col1 and col2... the database to sum the Items and display output so that it will be like... question what you have asked. select item, sum(quqantity) from `order` group
How to Delete a column and Add a new column to database
How to Delete a column and Add a new column to database   How to Delete a column and Add a new column to database   Hi, The following query is executed for add and delete a column in a table- for drop a column
sum
sum  a program to find the sum of the alternative diagit of it ex- no=123456 sum=1+3+5=9
sum
; sum=sum+s; if(i==n){ System.out.print(s...+"+"); } System.out.print("\nSum of the series : "+sum
Make Unique Column in Database Table
Make Unique Column in Database Table   ... a unique key in a column of a database table. While declaring unique key in a column we should check whether this column is eligible to store a unique
Delete a Column from a Database Table
Delete a Column from a Database Table   ... to delete a column from a database table. We are not going to create a new table... a column from a database table then we have been provided with the  database
MySQL Column Type Database
MySQL Column Type Database     ... of column in MySQL . MySQL supports the numeric type , Date and time type, and String type (char) database. MySQL Numeric type and String type Database
Remove Unique Column in Database Table
Remove Unique Column in Database Table   ... unique field of the particular column in a database table.  We know... the particular column in the database table. In this query we will give table and column
Sum - JSP-Servlet
the total sum of items from database using Java servlet or Jsp and html form. It should display the affected rows and the total sum of all in a seperate column..., Sum Into Database Salary
Adding a New Column Name in Database Table
Adding a New Column Name in Database Table  ... are going to learn about adding a new column in database table. Sometimes it happens...; Above code is used for adding a new column in the database table and takes
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  Hello Sir, I have developed a swing application in which database table... ,update,delete database values from jtable only so i added three buttons add
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  Hello Sir, I have developed a swing application in which database table is shown... ,update,delete database values from jtable only so i added three buttons add,update
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  Hello Sir, I have developed a swing application in which database table is shown... ,update,delete database values from jtable only so i added three buttons add,update
Arrange a Column of Database Table
Arrange a Column of Database Table   ... : This query shows data of a column in ascending order of the specific database table... for arranging the data of database table in ascending order. Firstly we should know
sum of the series
sum of the series  Program to sum the series 1+1/1!+1/2!+1/3!+....n
sum in JTable
sum in JTable  how to calculate sum from JTable's one field like total
Sum of seris
Sum of seris  Program to find the sum of the following series using a function declaration. sum=x-(xxx)/3!+(xxxxx)/5!-(xxxxxxx)/7!+.....(xx....x)/n!. Where n and x are entered from the keyboard
Arrange a Column of Database Table
Arrange a Column of Database Table   ... that arrange the records of database table in descending order. The descending... with MySQL database. As soon as the connection gets established it takes a table
Sum of integers
Sum of integers  A Java program that reads an integer value from the user and displays i) the sum of all even integers between 1 and the input value, both inclusive. ii) The sum of all odd integers between 1 and the input
How to insert multiple drop down list data in single column in sql database using servlet
How to insert multiple drop down list data in single column in sql database using servlet  i want to insert date of birth of user by using separate drop down list box for year,month and day into dateofbirth column in sql server
sum
sum
sum
sum
sum
sum
sum
 

 

 

DMCA.com