473,396 Members | 1,989 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.

Aggregate two fields

Hi,
I have the Following Table [SALES]:

Month Quantity1 Quantity2
Jan 100 150
Feb 500 100
Mar 100 0

I need a query that can Aggregate Quantity1 and Quantity2, so I can
get:

Month [Quantity1+Quantity2]
Jan 250
Feb 600
Mar 100

SELECT Month, [Quantity1+Quantity2] as TOTAL FROM SALES
.... is this Query is OK? I get A blank result

Regards
LC

Nov 13 '05 #1
3 1220
how about
SELECT Month, Quantity1 + Quantity2 As TOTAL
FROM Sales;

Nov 13 '05 #2
jr
This is how it works if using Access 97 2000 2002 xp

SELECT Month, [Quantity1]+[Quantity2] as TOTAL FROM SALES
.... is this Query is OK? I get A blank result

SELECT Month, [Quantity1+Quantity2] as TOTAL FROM SALES
.... is this Query is OK? I get A blank result

<ca******@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
I have the Following Table [SALES]:

Month Quantity1 Quantity2
Jan 100 150
Feb 500 100
Mar 100 0

I need a query that can Aggregate Quantity1 and Quantity2, so I can
get:

Month [Quantity1+Quantity2]
Jan 250
Feb 600
Mar 100

SELECT Month, [Quantity1+Quantity2] as TOTAL FROM SALES
... is this Query is OK? I get A blank result

Regards
LC

Nov 13 '05 #3
This works for a table I have.
SELECT Payments.PY_PayDate, [PY_CourseAmtPaid]+[PY_TextAmtPaid] _
AS Total FROM Payments;

The only thing I can see is month is a reserved word and and the
; at the end you may need to say:

SELECT Sales.Month, [Quantity1+Quantity2] as TOTAL FROM SALES;

HTH
Ron
jr wrote:
This is how it works if using Access 97 2000 2002 xp

SELECT Month, [Quantity1]+[Quantity2] as TOTAL FROM SALES
... is this Query is OK? I get A blank result

SELECT Month, [Quantity1+Quantity2] as TOTAL FROM SALES
... is this Query is OK? I get A blank result

<ca******@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
I have the Following Table [SALES]:

Month Quantity1 Quantity2
Jan 100 150
Feb 500 100
Mar 100 0

I need a query that can Aggregate Quantity1 and Quantity2, so I can
get:

Month [Quantity1+Quantity2]
Jan 250
Feb 600
Mar 100

SELECT Month, [Quantity1+Quantity2] as TOTAL FROM SALES
... is this Query is OK? I get A blank result

Regards
LC



Nov 13 '05 #4

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

Similar topics

1
by: sausage31 | last post by:
I have a table as follows.... Device LotID Result1 Result2 Result3 aaa 1 5 10 15 bbb 1 2 4 6 aaa 2 ...
2
by: deko | last post by:
SELECT Nz(Min(),#1/1/1000#) AS NextAppt, Appt_ID FROM tblAppointments WHERE Entity_ID=!! AND ApptDate>=Date() If I do not include Appt_ID, it works fine. But I need the ID so I can join other...
1
by: nfrodsham | last post by:
In Microsoft's help literature, it states: "You can filter out non-unique rows by using the DISTINCT option of an aggregate function" I am trying to do this in Access 2003 with the COUNT...
10
by: neb | last post by:
Dear member of the forum, Ms access has built-in aggregate function like: -Sum, Max, First, Avg, ... Is it possible to build user-defined aggregate? (if you have any clue, do not hesitate to...
0
by: Not Me | last post by:
Hey, I have a report featuring a handful of subreports, a field taking values from the main record source, and a field in the report footer which displays the sum of values in said field. The...
2
by: Shannan Casteel via AccessMonster.com | last post by:
I have an invoice form with Parts and Labor as subforms. The parts section is based on a query that pulls data from 2 tables (tblParts & tblPartPerClaim) .. It has fields: ClaimID:...
3
by: S P Arif Sahari Wibowo | last post by:
Hi! I would like to make an editable continous form, where most fields will be from table A and editable, except 1-3 fields are a glimpse into table B and uneditable. Table A relate to table B...
2
by: rdemyan via AccessMonster.com | last post by:
I can't seem to get the following SQL statement with the ORDER BY clause to work. It does work if I order by any of the fields in the SELECT part of the statement but not if it is the field in the...
3
by: Aaron | last post by:
I have been searching the boards trying to find an answer to this question and no luck. I am using a query similar to this: Select count(col1) from table1 I was having a hard time accessing...
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
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...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.