Sum one field in multi field query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have a query that has several fields. The fields range in type from
number to currency, to autonumber.

I would like to sum just one of the fields in this query. Is that possible?

Thanks

Connie
 
Hi all,

I have a query that has several fields. The fields range in type from
number to currency, to autonumber.

I would like to sum just one of the fields in this query. Is that possible?

Ummm... yes.

It's much easier to sum one field than to sum several.

What problem are you having? Could you post the SQL of the query, perhaps a
record or two of sample data, and the desired result?

John W. Vinson [MVP]
 
I have tried several different ways to sum the field, read every thread that
might relate and tried all suggestions, and I keep getting an error, or it
simply doesn't work. If I sum and/or group all fields, there is no problem,
just won't let me sum one field...not sure why.

Regardless, I did find another way around it, so thanks anyway.
 
I have tried several different ways to sum the field, read every thread that
might relate and tried all suggestions, and I keep getting an error, or it
simply doesn't work. If I sum and/or group all fields, there is no problem,
just won't let me sum one field...not sure why.

Well, we'd be glad to help if you would let us, but it seems you have chosen
not to do so. Good luck!

John W. Vinson [MVP]
 
Connie said:
Hi all,

I have a query that has several fields. The fields range in type from
number to currency, to autonumber.

I would like to sum just one of the fields in this query. Is that possible?

Thanks

Connie

Connie,

The following is based on your description above. It is also untested
(but the basic idea is correct).


SELECT YT1.YourColumn1
,(SELECT SUM(YT2.YourColumn2)
FROM YourTable AS YT2)
,YT1.YourColumn3
FROM YourTable AS YT1


The above SUMs just one column in your query.


Sincerely,

Chris O.
 
Thanks Chris! I will give it a try.

Chris2 said:
Connie,

The following is based on your description above. It is also untested
(but the basic idea is correct).


SELECT YT1.YourColumn1
,(SELECT SUM(YT2.YourColumn2)
FROM YourTable AS YT2)
,YT1.YourColumn3
FROM YourTable AS YT1


The above SUMs just one column in your query.


Sincerely,

Chris O.
 
Back
Top