0
I have the following table below and would like to catch the monthly evolution (%) of the total transactions per month. I researched the LAG function but could not understand very well.
I need the feedback of this consultation to be like this:
MÊS | TOTAL TRANSACOES | % EVOLUCAO
-----------------------------------
09 | 45.561 | 0%
10 | 48.598 | 6.66%
SQL:
CREATE TABLE IF NOT EXISTS `campanha` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ano_mes` date DEFAULT NULL,
`nome` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`cpf` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`conta` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`valor` float(10,2) UNSIGNED ZEROFILL NOT NULL,
`transacoes` int(255) DEFAULT NULL,
PRIMARY KEY (`id`)
)
Could someone help me?
Mysql Version: 5.7.23 - Mysql Community Server
No one to help? :(
– gugoan