473,386 Members | 1,827 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.

Getting the sum of two fields from a view

I am new to php and mysql and was just introduced to the use of view.
I have a view from two table and i need to sum up two fields from the view. Please help me in achieving this.

I need to get the sum of statement.cscs and clients.cscs (one for every client)

Expand|Select|Wrap|Line Numbers
  1.  
  2.   SELECT clients.cscs as cscs, clients.fname as fname, clients.lname as lname, 
  3.   clients.address as address, clients.emailad as emailad, clients.phone as phone, 
  4.   statement.transdate as tdate, statement.narration as narration, statement.debit as debit, 
  5.   statement.credit as credit FROM clients, statement where clients.cscs = statement.Cscs;
  6.  
  7.  
  8.  
Jun 3 '11 #1
1 1781
code green
1,726 Expert 1GB
SUM is used to sum the rows of a field.
You need to add....
Expand|Select|Wrap|Line Numbers
  1. (statement.cscs + clients.cscs) CSCS
Jun 6 '11 #2

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

Similar topics

12
by: Neil | last post by:
I previously posted re. this, but thought I'd try again with a summary of facts. I have an Access 2000 MDB with a SQL Server 7 back end. There is a view that is linked to the database via ODBC...
2
by: Alex | last post by:
Hi all, I'm running into a road block, and I know I've done this before. I'm getting fields from two tables, and I need to do a count of similar items with it showing some extra info. Here's...
20
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
0
by: John | last post by:
Hi I have drawn a number of fields on a grid layout. How do I get the fields to become part of a form? I had tried putting <form> </form> tags at various places such as within the grid layout...
10
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
13
by: Selesti | last post by:
I have written an Access database that our department uses to store and analyze information on particular jobs. Because our company runs on an enormous SQL DB, I thought it would save some time if...
2
by: gz | last post by:
Good morning everyone, I am writing a module that needs to access fields in classes efficiently. The trouble is that the module does not know the classes beforehand, although the user of the...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
4
by: dwasbig9 | last post by:
Hi Group, I'm creating a maintenance switchboard and am trying to create forms to update tables and wanted these to appear as datasheets. Although I have the default view set to datasheet and...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.