Caluculating sum of activity
Posted
by
Maddy
on Stack Overflow
See other posts from Stack Overflow
or by Maddy
Published on 2012-10-18T04:53:28Z
Indexed on
2012/10/18
5:01 UTC
Read the original article
Hit count: 97
I have a table which is with following kind of information
activity cost order date other information
10 1 100 --
20 2 100
10 1 100
30 4 100
40 4 100
20 2 100
40 4 100
20 2 100
10 1 101
10 1 101
20 1 101
My requirement is to get sum of all activities over a work order ex: for order 100
1+2+4+4=11
1(for activity 10) 2(for activity 20) 4 (for activity 30) etc.
i tried with group by, its taking lot time for calculation. There are 1lakh plus records in warehouse. is there any possibility in efficient way.
SELECT SUM(MIN(cost))
FROM COST_WAREHOUSE a
WHERE order = 100
GROUP BY (order, ACTIVITY)
© Stack Overflow or respective owner