Please consider this result (Report):
State Value1 Value2 Value3
---------------------------------------------
State1 103 23% 3
State2 105 32% 12
State3 150 2% 23
Group1 120 19% 3
===================
State4 200 40% 5
State5 250 2% 12
Group2 225 21% 8
===================
...
I have groups and each group contains some states. No I want to run a query on my details data and run some custom function on each group to obtain Value1
to Value3
. For simplicity consider AVG
function.
I'm using Group By
clause to generate states result but how I can merge group of states with my result?
Thanks
Edit 1)
this is the basic Data and this may not match above output:
Id StateName Value1 Value2 Value3
1 State1 1 2 3
2 State2 4 2 2
3 State2 3 3 8
4 State2 3 8 5
...
Edit 2)
For Example :
State1, State2, State3 Belong to `Group1`
State4, state5 Belong to `Group2`
...