I have a procedure, running every day, to tell me which payments have to be made 7 days from today. I encountered a problem, and I have not discovered how to fix it. If a payment date is set to be made 7 days from a Saturday or a Sunday, I will not have any results.
SELECT CONCAT(' ',CONVERT(date, pdata),' '),
CONCAT(' ',adoc,' '),
CONCAT(' ',nome,' '),
CONCAT(CONVERT (money, etotal), ' €'),
aprovado
FROM xxx.dbo.fo
WHERE aprovado like '0'
and pdata between DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0)
and DATEADD(day, 7, GETDATE())
what I need is, the Monday after that weekend (where eventually the payment is set to be made) get the results in this select.