473,396 Members | 1,712 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,396 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 22494
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...
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
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?
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
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.