473,383 Members | 1,762 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,383 software developers and data experts.

Adding values in 2 columns in Access

Hi!

Here I need help from you all - I would like to add values in 2 columns and write them to a third column and get the avg value of the third column.

For Example:
Expand|Select|Wrap|Line Numbers
  1. ColumnA  ColumnB  ColumnC
  2.  
  3. 1          5          6
  4.  
  5. 2          6          8
  6.  
  7. 3          7         10
  8.  
  9. Avg                    8
Now I would like to run a query on a table - to add column A and Colum B, writing the sum to column C and finding avg of values in Column C.

Thanks in anticipation of your help.

Regards,

Omnitha
Aug 28 '08 #1
1 3684
NeoPa
32,556 Expert Mod 16PB
There's really no point in writing ColumnC. Just display it instead.

Assuming a table :
Table Name = [tblMyTable]
Expand|Select|Wrap|Line Numbers
  1. ColumnA  Number
  2. ColumnB  Number
...then the following SQL provides your initial results set :
Expand|Select|Wrap|Line Numbers
  1. SELECT ColumnA,
  2.        ColumnB,
  3.        ColumnA+ColumnB AS ColumnC
  4. FROM tblMyTable
A query to show the average of ColumnC would need to be a separate query, and could be :
Expand|Select|Wrap|Line Numbers
  1. SELECT Avg(ColumnA+ColumnB) AS [Avg]
  2. FROM tblMyTable
Aug 28 '08 #2

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

Similar topics

1
by: Frank | last post by:
I have a large form, that has text boxes of numbers in rows and columns. I need to sum the values in the columns, and put the total at the bottom of the column. But I also need to sum the values in...
5
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
0
by: juli jul | last post by:
Hello, I want a table with 2 columns in a dataset : my problem is that I have to add the values of the first column and only than the values of the secound (from the adapter) - but when adding the...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
12
by: Art | last post by:
Hi everyone I was hoping someone might be able to help me with this. I'm just starting to try to work with MS Access tables through VB.net. In Access I can take an existing table and add a new...
4
by: Sam | last post by:
Hi, I'm adding columns to a datatable as followed. The values are from textboxes or comboboxes. The first column is properly field but then all the subsequent columns just contain "", whereas the...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
2
by: canoewhiteh2o | last post by:
I am having trouble adding data columns to a disconnected database. I first load a datatable using: private DataTable dtMacros = new DataTable(); private ArrayList macro = new ArrayList();...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.