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

How to Add two Columns from SQL Select?

Im currently having difficulty trying to write an SQL query in Access
which will add two columns together to calculate a totals column. For
example...

I was hoping to get the below resultset from my query, e.g.
"select name, hours, overtime, hours+overtime as total"

Name Hours Overtime Total
--------------------------------------
Bloggs 8 2 10
Smith 8 0 8
Jones 6 3 9
...
...
...etc

But the query I am trying does not work, I was also trying the sum
aggregate function but I assuming this will only sum the contents of 1
column.

Any help with this would be much appreciated!

Nov 13 '05 #1
1 22493
On 16 Jun 2005 06:04:16 -0700, da*********@gmail.com wrote:

Other than wrapping the Name field in square brackets (because it is a
reserved word), your SQL is correct, assuming you also have a From
clause.

-Tom.

Im currently having difficulty trying to write an SQL query in Access
which will add two columns together to calculate a totals column. For
example...

I was hoping to get the below resultset from my query, e.g.
"select name, hours, overtime, hours+overtime as total"

Name Hours Overtime Total
--------------------------------------
Bloggs 8 2 10
Smith 8 0 8
Jones 6 3 9
..
..
..etc

But the query I am trying does not work, I was also trying the sum
aggregate function but I assuming this will only sum the contents of 1
column.

Any help with this would be much appreciated!


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: tgru | last post by:
Does anyone know a select statement that would return the column names and keys and indexes of a table? Thanks, TGru *** Sent via Developersdex http://www.developersdex.com *** Don't just...
7
by: Iver Erling Årva | last post by:
Lets say I have a table PortDates with 3 columns like this: PORT ARRIVALDATE SAILINGDATE NewYork 12-15-2004 Rio 10-12-2004 Hamburg ...
2
by: Fresh Air Rider | last post by:
Hello Does anyone know how to display data from a data source such as an array or SqlDataReader etc within an HTML table whose number of columns can change according to the value of a variable ?...
6
by: OhMyGaw | last post by:
Hey guys, Couldn't find this anywhere in google. I want a list of all database column names for a specific table/view from across database. I tried this......
1
by: Alex | last post by:
Hi, is it possible to concatenate two rows (same or different data type) into one. like First Name, Last Name or ZIP City etc. Thanks Alex
1
by: Joe | last post by:
I've been playing with the infragistics ultrawebgrid and I'm trying to do something that seems like it should be a piece of cake. I want to setup the columns, select a datasource and bind it...
4
by: rdemyan via AccessMonster.com | last post by:
I have the following SQL statement in code that is set to the RowSource of a combobox. The combobox has two columns. SELECT '(ALL)' As Site, '' As , 0 As SortFirst FROM GROUP BY SITE_COMPLEX...
4
by: Lionel Pinkhard | last post by:
Hi I currently have a select query with "Description = 'input from user here'" which basically returns the associated row containing the Description field exactly as typed by the user, however,...
8
by: Remaniak | last post by:
Hi All, I am using Access 2003 and I want to show in my query all columns from a table that have values. Its probably a simple question but I have not been able to crack it so far. My code is...
8
by: Sham | last post by:
I am trying to perform the following query on a table that has been indexed using Full Text Search. The table contains multiple columns than have been indexed. (Below, all xml columns are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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...
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: 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...

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.