I have the following variables:
$v_data = $row['DATA'];
$v_filial = $row['FILIAL'];
$v_chapa = $row['CHAPA'];
$v_func = $row['FUNCIONARIO'];
$v_dias = $row['DIAS'];
$v_desc = $row['DESCRICAO'];
They bring this:
DATA FILIAL CHAPA FUNCIONARIO DIAS DESCRICAO
10-04-2016 2 2311 JOAO DE SOUZA 7 TESTE
24-04-2016 2 2311 JOAO DE SOUZA 14 TESTE
08-05-2016 2 2311 JOAO DE SOUZA 14 TESTE
15-05-2016 2 2311 JOAO DE SOUZA 7 TESTE
05-06-2016 2 2311 JOAO DE SOUZA 21 TESTE
12-06-2016 2 2311 JOAO DE SOUZA 7 TESTE
What I need: Where dates are equal add the column days and if possible change the date column, example:
DATA FILIAL CHAPA FUNCIONARIO DIAS DESCRICAO
10-04-2016 2 2311 JOAO DE SOUZA 7 TESTE
24-04-2016 2 2311 JOAO DE SOUZA 14 TESTE
Expected result:
DATA FILIAL CHAPA FUNCIONARIO DIAS DESCRICAO
04 2 2311 JOAO DE SOUZA 21 TESTE
@Marllon Nasser, follow query:
SELECT
ifd_filial AS FILIAL,
ifd_chapa AS CHAPA,
ifd_nome AS NOME,
DATE_FORMAT(ifd_dataa,'%m') AS MÊS,
SUM(ifd_dias) AS DIAS,
ifd_desc AS DESCRICAO
FROM
imp_folga_domingo
WHERE ifd_chapa = 2311
GROUP BY ifd_dataa;