Link to home
Start Free TrialLog in
Avatar of Tina K
Tina KFlag for United States of America

asked on

Multiple functions in SQL select statement

For some reason, this really has me stumped.  I'm trying to retrieve the max transaction id from the inventory_transaction table, but also need to sum up some costs.  As soon as I start adding any of the costs, no matter how I do it, the max(inventory_trans) fails and I get a record for each different cost.

Example - this works:

User generated image
This doesn't:  I get 151 records, rather than the max:

User generated image
Also doesn't work:

User generated image
Any help appreciated!
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

SELECT part_id, MAX(...), SUM(ACT_BURDEN_COST + ...) AS act_cost
FROM ...
WHERE ...
GROUP BY part_id
Avatar of Tina K

ASKER

Hi Scott -
Gave that a try and get the same result of multiple records:

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tina K

ASKER

That did the trick Scott!  Thanks so much!