4
Next. Imagine I have in the bank in the paid months field the following releases: 2015-03, 2015-04, 2015-7, 2015-9. If we set a period for example: from 2015-02 to today (2015-9). Which months are missing, that is, which months have not yet been paid.
The query I present here brings paid months WITHIN period. But what I need ARE NOT the months paid, but YES the UNPAID MONTHS and WITHIN period. Ie 2015-2, 2015-5, 2015-6, 2015-8.
SELECT pagamentos.idPagamentos, pagamentos.mesReferencia FROM pagamentos, planosclientes
WHERE
pagamentos.idPlanoClientes = planosclientes.idPlanosClientes AND
pagamentos.idPlanoClientes = 8 AND
pagamentos.mesReferencia BETWEEN DATE_FORMAT(planosclientes.dataInstalacao, '%Y%-%m') AND DATE_FORMAT(CURRENT_DATE(), '%Y%-%m')
ORDER BY pagamentos.mesReferencia
How to do it in this case?
Carlos I don’t think I understand what you need, you want the extremes, wouldn’t it just be using the < and > signals instead of between? because I believe that there is no extreme after the Kurdish() on that date, or has ?
– SneepS NinjA
I changed the question to make it easier to interpret!
– Carlos Rocha