Using the Northwind database on Microsoft SQL Server, I'm trying tofind the last day of each month on which each employee has placed an order,as well as all the orders on that day by that employee.
for example: 1996-07-17 was the last day of month when employee 1 has placed an order. I want all the orders by employee 1 from this day.
select EmployeeID, max(convert(date, orderdate)) as LastDayfrom northwind.dbo.Ordersgroup by YEAR(OrderDate),MONTH(OrderDate),EmployeeIDorder by EmployeeID,LastDay;
This query returns the last days of months for each employee, but I couldn't get the orders.