Now there is a query statement: SELECT * FROM TBLERPINBOUND WHERE MDATE> 20210126
Hope MDATE of these changes could be changed with the date of the query, for example, I check MDATE is between 20210126-20210225, 20210126, I check my MDATE is in 20210225-20210326, 20210225 and so on
Could you tell me how to write about the SQL
CodePudding user response:
Are you saying that in the 20210126-20210225 a month on any given day to check, the SQL below & gt; 20210126 to become & gt; 20210126?SELECT * FROM TBLERPINBOUND WHERE MDATE> 20210126
CodePudding user response:
This calculation queries start date:
SELECT the CONVERT (VARCHAR (6), CASE WHEN DATEPART (DAY, GETDATE ()) & lt; 26 THEN DATEADD (MONTH, 1, GETDATE () ELSE GETDATE () in the END, 112) + '25'
CodePudding user response:
You the expected results some ambiguity, 20210126-20210225 between check MDATE is 20210126202022-20210326 five MDATE is 20210225, check that day in 20210225, 20210126 or 20210225Don't know if this means
SELECT * FROM TBLERPINBOUND
WHERE MDATE> (SELECT MAX (SPECIAL_DATE) FROM COUNTING_SPECIAL_DATE WHERE SPECIAL_DATE & lt;=CAST (GETDATE () AS the DATE))