I'm relatively new to SQL queries and need to automate a report that will mail on the first of the month and send info for last calendar month. So using the last 30 days is insufficient. Currently we have the report created with a prompt for dates. But I need to automate it so its not an option. Its for SAP Business one 9.1 with SQL.
Basically I need to replace this portion of an existing query below. to give last calendar months date range.
WHERE (%other logic%) and CONVERT(nchar(8), T0.DocDate, 112) >= [%0] AND CONVERT(nchar(8), T0.DocDate, 112) <= [%1]