several statements in one query

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

Guest

Hi,

I am new to access (obviously) and am wondering how to do the following.

Assume a table containing cd prices, each cd associated with a category (as in rock, pop etc etc). I want to use the sum functions to make a query that will summarize the value of the CDs in the different categories.

Example

Title Category Price
xxx rock 10
yyy pop 12
zzz pop 11
xyz rock 10

should return:
rock 20 pop 23

I know how to make these summaries individually but how do I write the two of them in one statement??

select sum(Price) where Category ="rock"
select sum(Price) where Category ="pop"

How do I combine these statements into just the one query?

Any help appreciated
 
Econ,

Create a new query, pull in your two fields, go up to
View/Totals and now set the Totals line in the grid to be
"GroupBy" for Category and "Sum" for the Price field.

Gary Miller
Sisters, OR

message
Hi,

I am new to access (obviously) and am wondering how to do the following.

Assume a table containing cd prices, each cd associated
with a category (as in rock, pop etc etc). I want to use the
sum functions to make a query that will summarize the value
of the CDs in the different categories.
Example

Title Category Price
xxx rock 10
yyy pop 12
zzz pop 11
xyz rock 10

should return:
rock 20 pop 23

I know how to make these summaries individually but how do
I write the two of them in one statement??
 
Back
Top