SQL Server – How to get First and Last day of current and previous month without time

Get first day of current month
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0) AS FirstDayOfCurrentMonth

Get last day of current month
SELECT DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) +1, -1) AS LastDayOfCurrentMonth

Get first day of previous month
SELECT DATEADD(month, DATEDIFF(month, 0, GETDATE())-1,

SQL Server – How to inner join a table to receive just one row of that table where a field is MAX. For example, has the greatest date.

This SQL statement will produce one row for each record found on the account_table for a given account number

We want also want to join the name and address table to the row. We only want one row from the …