About mysql group by function

I have to generate cumulative progress table like below.

[table] [tr] [td]Indicator[/td] [td]month 1 [/td] [td]month 2 [/td] [td]month 3 [/td] [/tr] [tr] [td]Indicator 1[/td] [td]10 [/td] [td]20 [/td] [td]25 [/td] [/tr] [/table]

But there are monthly values at mysql table. like this

[table] [tr] [td]Indicator[/td] [td]Month[/td] [td]value[/td] [/tr] [tr] [td]Ind 1[/td] [td]1[/td] [td]10[/td] [/tr] [tr] [td]Ind 2[/td] [td]1[/td] [td]10[/td] [/tr] [tr] [td]Ind 3[/td] [td]1[/td] [td]10[/td] [/tr] [tr] [td]Ind 2[/td] [td]2[/td] [td]10[/td] [/tr] [tr] [td]Ind 1[/td] [td]2[/td] [td]10[/td] [/tr] [tr] [td]Ind 1[/td] [td]3[/td] [td]5[/td] [/tr] [/table]

Therefore I used mysql group by function. My query is below.

SELECT month,SUM(Indicator) AS p FROM table1 WHERE Indicator='Ind 1' GROUP BY month

But considering about 50 indicators my table takes some time to load. How can I reduce time. Please help me.

Sponsor our Newsletter | Privacy Policy | Terms of Service