Is it possible to combine the year and the month together, and to pass the 20017-06
to the select?
SELECT SUM(valor) FROM contas where YEAR(data) = '2017' and MONTH(data) = '06'
Is it possible to combine the year and the month together, and to pass the 20017-06
to the select?
SELECT SUM(valor) FROM contas where YEAR(data) = '2017' and MONTH(data) = '06'
If possible, use the date_format()
function by passing the desired format instead of the two functions. Y
for the year with 4 digits and m
for the month with two digits.
SELECT SUM(valor) FROM contas where date_format(data, '%Y-%m') = '2017-07'