1
People, in the query below want to put a condition within the Where that bring only the tasks that are due two months after the opening date. For example. The task 11111 was opened on 01-11-2017 and is due on 01-01-2018, so it is to return this task in the query.
SELECT
tarefaid,
dataabertura,
datavencimento
FROM Tarefa t
LEFT JOIN Usuario ur
ON ur.UsuID = t.UsuIDResponsavel
LEFT JOIN Usuario uc
ON uc.UsuID = t.UsuIDCliente
WHERE t.TarTipID IN (727, 1053)
AND t.TarNumAtiv = 0
AND t.TarStatus <> 9
AND t.TarEstagioID IN (240, 461)
AND ur.UsuIDGrupo = 30
AND uc.UsuTipo = 'C'
AND uc.EmpLiberada = 1
AND MONTH(t.tarvencimento) = 01
The Task table already has the correct due date ?
– Oliveira
yes, all tasks already exist a due date.
– Renan Bessa