I want to get previous month report.
For e.g., if system date is March '2023-03-04' and i need previous month report with first date and last date
select * from purchaseinvoice p where convert(Date,p_date) between '2023-02-01' and '2023-02-28'
if system date is July '2023-07-08'
select * from purchaseinvoice p where convert(Date,p_date) between '2023-06-01' and '2023-06-30'
I need a general mssql statement. Please provide answer.