DSum in Query

  • Thread starter Thread starter D
  • Start date Start date
D

D

In my query, I have a field: New_Cost:[AllocatedCost]+[Base]

I need to get the Total of that column and divide by each record [New_Cost]
to come up with a percentage in a new field -- New_Cost_Percentage.

Can this be done and if so, how?
 
SELECT itemID,
SUM(qty) AS totalForThisItem,
SUM(qty) / (SELECT SUM(qty) FROM myTable) AS percentage
FROM myTable
GROUP BY itemID


is an example about how you can do it (in SQL view of the query). change the
table name and the fields name (any thing which is not all cap), as
appropriate for your case.


Hoping it may help,
Vanderghast, Access MVP
 

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

Similar Threads

dsum in query 3
DSum in Queries 3
DSum in Query 3
dsum sytax error 5
Parameter Query with DSum 1
DSum update query with multiple fields 0
DSum function 3
Ungrouping in DSUM 4

Back
Top