I have a table where each customer can submit many requests, but only latest requests would be entertained.
For example, Customer1 may have only submitted 1 request and CustomerX may have submitted 10 requests. So when I pull the report it would bring the 1 request by customer1 and the 10th request by CustomerX.
How can I do that?
Customer Id, FoodSelection1, FoodSelection2, DateSubmitted
You can use the WITH TIES clause in concert with Row_Number()
Select Top 1 with ties *
From YourTable
Order By Row_Number() over (Partition By CustomerID Order by DateSubmitted Desc)