Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

All orders of the last day of the month for each employee

$
0
0

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.


Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>