I have a history table in SQL Server that basically tracks an item through a process. An element has some fixed fields that do not change throughout the process, but has several other fields, including status and identifier, which increase as the process steps increase.
Basically, I want to get the last step for each item specified in the Batch Reference. Therefore if i do
Select * from HistoryTable where BatchRef = @BatchRef
It will return all steps for all elements in the package - for example
Id Status BatchRef ItemCount
1 1 Batch001 100
1 2 Batch001 110
2 1 Batch001 60
2 2 Batch001 100
But I really want:
Id Status BatchRef ItemCount
1 2 Batch001 110
2 2 Batch001 100
Edit: Appologies - it doesn't look like the TABLE tags work with Markdown - followed the email help and look great in the preview
source share