Thread: Query problem and totals URGENT!
05-12-04, 18:51 #1Registered User
- Join Date
- May 2004
Unanswered: Query problem and totals URGENT!
Hi there folks,
I have a problem with a query I'm building.
I want a calculated field to deduct one figure in one field, from a figure in another. But one of the fields needs to be grouped by another field! Its hard to explain, but in one table, I have a stock code. In another table I have orders for that stock item in various records. In another table I have a record for the items currently in stock.
I need to calculate the total number of items ordered for each stock item (done) and deduct from this the amount of stock items currently in stock. But when I do this, the query deducts the amount in stock from every record in the order table, where this should only be done once.
I was able to do this earlier by fiddling about, but I just cant seem to get it working again!
Help would be greatly appreciated!!!
05-12-04, 20:22 #2(Making Your Life Easy)
Provided Answers: 10
- Join Date
- Feb 2004
- New Zealand
When using the Groupby function use the Expression as well
this tell the query to do the Groupby first then do the Expression Last
also make shour the Expression are at the End of the Query
Groupbys -> Sums ->Expression
when you group by and sum the new feild is name sumof.....
therefore the Expression should show the in the forumla GST: SumOftotal*.125
i would name then other wise you start getting umOfSumOftotalhope this help
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
VB-NET based on my own environment started 2007
SQL-2005 based on my own environment started 2008
YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
THEY'RE BEHIND YOU FOR A REASON