Need help with this sql code, I would like to roll back start day of new month if last day of pervious month has values.
Thanks
Need help with this sql code, I would like to roll back start day of new month if last day of pervious month has values.
Thanks
I would suggest nesting EOMONTH() in an IF statement.
Not sure what table(s) you're working with, but general layout would be: IF(MAX(date_column) = EOMONTH(MAX(date_column), MAX(date_column), new_date)
Reference for EOMONTH(): https://www.sqlservertutorial.net/sql-server-date-functions/sql-server-eomonth-function/