0
I am doing a query in SQL and as a constraint I want the query to return the data from the first day of the previous month until today.
For example: If I run today (10/04/2019) the query, will return only entered data from 01/03/2019 until now.
To do this I created the following restriction:
SD1010.D1_DTDIGIT>=(YEAR(GETDATE())+ (MONTH(GETDATE())-1) + ('01')) AND
SF1010.F1_DTDIGIT<=GETDATE()
With this constraint the query does not return any data.
Welcome, this forum is in Portuguese, please translate your question.
– André Lins
Welcome to the Stackoverflow in Portuguese. As the name suggests, the official language used here is Portuguese. So, could you please translate your question? If you prefer, you can also ask the same question on Stackoverflow website in English.
– Sorack
You didn’t report which one
SGBD
. And neither will your table structures.– Sorack
I believe that the result of YEAR(GETDATE())+ (MONTH(GETDATE())-1) is numerical and not a string of characters as you seem to expect (in your example it would be 2022 and not "201903").
– anonimo