Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Calculations

Status
Not open for further replies.

tbassngal

Programmer
Feb 18, 2003
74
US
Hi Guys... this is just a query question - not code, I hope I am in the right spot! I have the following query... what I want to do is create a calculation for item ids of the same expenditure for total cost. Example: like items - AHB60590 component gives us a final cost of $16,555.25

How can I set this up... I am stumped because I would usuall do something like this in a report... but even still, haven't done that in a report in a very long time. Please help! thank you so much in advance.

PROJECT ID # ITEM # EXPENDITURE TotalCost
214710 AHB59115 CONTAINER $0.00
214710 AHB59115 SAMPLE $2,700.00
214710 AHB60590 COMPONENT $3,311.25
214710 AHB60590 COMPONENT $13,245.00
214710 AHB60590 DESIGN $2,978.00
214710 AHB60590 SAMPLE $0.00
214710 AHB60590 SAMPLE $19,094.00
214710 AHB60591 TOOLING $44.15
214710 AHB60591 TOOLING $5,397.00

Tina
 

Hi,
Code:
Select [PROJECT ID #],[ITEM #],SUM(TotalCost)
From MyTable
Group By [PROJECT ID #],[ITEM #]


Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
SELECT ProjectID, Item, Expenditure, Sum(TotalCost) as TotalItemCost
GROUP BY Item, Expenditure

-DNG
 


DotNetGnat,

Won't sum to the Item WITH Expenditure.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top