Staff have a problem with extracting dates in a training range. What I need is the following if a training started on 01/01/2017 and its completion on 03/03/2017 elevate should return in the select below for the months 01.02 and 03. Today this select only returns me the trainings that were created within a Month.
SELECT distinct *
FROM treinamentos,usuario_x_treinamento,usuario
WHERE status_treinamento = 'REALIZADO'
AND treinamentos.data_inicio_treinamento >='2017/01/1'
AND treinamentos.data_inicio_treinamento <='2017/01/31'
AND usuario_x_treinamento.id_usuario = usuario.id_usuario
AND usuario_x_treinamento.id_treinamento = treinamentos.id_treinamentos;
But since I'm only using the range on the start date, I can not make the selection I need.
PS: Select runs for all months of the year (used to generate a report).
What I need is to keep the Month-to-Month range, but also take into account the training that goes on for more than a month.