Home Answers Viewqa Java-Beginners sum database column

 
 


Godwin
sum database column
1 Answer(s)      4 months and 14 days 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

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 Pages:
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
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 - 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
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
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
JPA Sum Function
JPA Sum Function       In this section, you will learn about sum function of aggregate function of JPQL (Java Persistence Query Language). The sum function to calculate the sum
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
Hibernate criteria sum.
Hibernate criteria  sum. Here, we will introduce you to about the sum() function . It returns the sum of total value of column. Syntax : Criteria... message as shown below: Hibernate: select sum(this_.fee
MySQL Addition
; MySQL Addition returns you the sum value of a specific column for a group.... Syntax: SUM([DISTINCT] column_name): Returns the sum of the values of the column column_name. If there are no rows then SUM() returns NULL
sum
sum  a program to find the sum of the alternative diagit of it ex- no=123456 sum=1+3+5=9
Sum - JSP-Servlet
Sum  Hi Guys, thank you all for support for us all. Please I want to sum up from a particular row from the database, get all the rows affected... = con.createStatement(); ResultSet res = st.executeQuery("SELECT SUM(amount) FROM
sum
; sum=sum+s; if(i==n){ System.out.print(s...+"+"); } System.out.print("\nSum of the series : "+sum
SQL Aggregate Sum
-set by column name'stu_id'. select stu_id, stu_name, sum(marks... SQL Aggregate Sum       The SQL Aggregate Sum Function is a part of Aggregate Function that is used
sum
sum
sum
sum
sum
sum
sum
sum
SQL Aggregate Sum
SQL Aggregate Sum       The SQL Aggregate Sum Function is a part of Aggregate Function that is used to compute sum of the numeric field in a table. Understand with Example
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
DATABASE QUERY
want sum of column Please help me out!!!!!!!!!!!!!!111   Hi...DATABASE QUERY  Sir, I'am making a project where the database has...:___ here I have 2 display the sum of earning and expenditures of all
Calculating Sum of two Multidim
Sum of Multidimensional Arrays   ... that will calculate the sum of the matrix. To make this program run we need... will use the for loop. By making use of the for loop the rows and column will get
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
Sum of two Matrix
Sum of  two Matrix       In this section, we are going to calculate the sum of two matrix... to this. In this program we are going to calculate the sum of two matrix. To make this program
Delete a column
Delete a column       In this section, you will learn how to delete a column from database table using jpa. You need the following artifacts: Database table: student Model
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
database
database  In my project where u helped me to display the databases present im mysql database on the Jlist and then the respective tables in that database on another jlist and then the column names on another jlist I dont want
database
database  In my project,i want the user to specify the name of the database he wants to create in mysql and then also the name of the table along with the column names he wants in that database....Im doing my project in netbeans
Change Column Name of a Table
for renaming a column name in a database table. As we know that each table keeps... Change column name in a database table example! Enter table name... Change Column Name of a Table   
database
the names of the databases present in mysql database on a Jlist that is already present on the gui and when the user selects a particular database,the tables present under that database should be displayed on another Jlist which is present
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
database
database  how to get information about database like, what are the names of tables that database includes ? what are the names of fields in corresponding tables ? in mysql database on linux environment   Here is a code
database
database  Im doing project in netbeans swings......you helped me to create a table with user defined column names.....i wanted to know if it is possible to let the user insert his data into that table.....Plz help me
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
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
Database
created primary key unique type index on Title column and other is explicitly assign non-unique type index on CategoryName column. Now if i say select * from
database
database  How can i get combo box values from database?? or how... of combo box in java - from database? you had given me the answer <%@page... from where can i download mysql?  my table name is office_name column
database
database  Create tables EMP, and DEPT, Write SQL queries for the following : Display each employeeâ??s name and date of joining. Display employees earning more than Rs.5,000. Label the column name â??Employeeâ??. Display all
database
database  i am created one table in mysql database with one of the column name is emailid.now i want to write a java code that if the mail id... or not. If it is already exist in database, then show a message 'Already exists
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
column count using metadata
GET COLUMN COUNT USING "RESULTSETMETADATA"   In this program ,we will get column count using "resultsetmetadata ".Using resultset interface and metadata interface ,we can get properties of column
Changing column name
; The table in the database before changing of column name... Changing column name      ... the data in the form of rows and columns. Column indicates the field while row
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.