Criteria Help

C

Christopher Austin

In a query, I am using the DSum function to add all of the
values in a domain from a table. I am trying to add
criteria, inside the DSum function, to this so that it
only chooses certain values.

ex. item# cost
1 $1
1 $2
2 $3

I would like to be able to query item #1 and retrieve $3,
however, I can only get it to sum the entire list
resulting in $6. How can I fix this?
 
D

David Bartosik - MS MVP

try this using your example select item#,sum(cost) from table where item# =1
group by item#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top