473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sum of MYSQL fields

Hai Masters,
I have a problem in getting the summation of Mysql database several fields.
It is like this.
My database name -BAR
Table - Pda
There are several fields in the table like A1,A2, A3 ... in a one record.
And data( in int type) has been entered already. Numbers have been entered as data.

I want to display the Sum of A1,A2 and A3.. ( total amount of all fiedls in a one record- displaying by one by one acording to records) when i am recalling the data.
Please send me the PHP coding for it.

Or send me the guidelines to make a another field by including the Summation of other fields in the same record.

Thank you.
IS
Oct 23 '07 #1
2 1489
amitpatel66
2,367 Expert 2GB
Hai Masters,
I have a problem in getting the summation of Mysql database several fields.
It is like this.
My database name -BAR
Table - Pda
There are several fields in the table like A1,A2, A3 ... in a one record.
And data( in int type) has been entered already. Numbers have been entered as data.

I want to display the Sum of A1,A2 and A3.. ( total amount of all fiedls in a one record- displaying by one by one acording to records) when i am recalling the data.
Please send me the PHP coding for it.

Or send me the guidelines to make a another field by including the Summation of other fields in the same record.

Thank you.
IS
Try below query:
Expand|Select|Wrap|Line Numbers
  1. SELECT A1 + A2 + A3 FROM bar.pda;
  2.  
In PHP you could try something like shown below:
Expand|Select|Wrap|Line Numbers
  1. $query = mysql_query("SELECT A1 + A2 + A3 FROM bar.pda");
  2.  
Oct 23 '07 #2
pbmods
5,821 Expert 4TB
Heya, isurujaya. Welcome to TSDN!

MySQL has a SUM() function for exactly that.
Oct 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Bruce A. Julseth | last post by:
Newbie Question: Is there a way to import MS Access into MySQL? Maybe create a CSV or something. If so, what would be the SQL to do this? Thanks... Bruce
4
by: Ben | last post by:
Hi I am new to C++ and I want to know if C++ is suitable for making a GUI application with a MySQL database. I also want to know what keywords in books I should look for. Is DATA STRUCTURES a...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
2
by: Sam White | last post by:
I have set up a MySQL db on one server, IIS 6.0 on another. Using Frontpage I created some forms to input data. On a test page I made, I have 4 fields. First is the ID which is autonumber (I leave...
2
by: pholck | last post by:
A newbie question here: I'm linking to a MySQL backend table with a million+ records, where two fields are of type datetime. However Access considers those fields to be text. Can't seem to get...
0
by: NewbieSupreme | last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x, which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a table to a text file, tab-delimited, text qualifyer...
5
by: Marijn | last post by:
Hello everybody, I am new to PHP and working on extending my knowledge of OOP. The posts in this group concerned with whether or not to use an OO approach when programming in PHP is not what I...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly...
0
by: tedpottel | last post by:
Hi I am trying to right a script to keep a local copy of my mysql database in a local access file. I was able to do this in Access visual basic, but cannot get it to work in python. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.