I just cant work this out in a single query.
Table TblQcProduction
has a record for each operator on a Production order.
I need to find out who the last operator was that reported against the production order.
SELECT IDX, ProdOrder, Operator
FROM dbo.TblQCProduction
Returns:
IDX ProdOrder Operator
8050745 325184 13012
8050746 325184 13035
8050747 325184 13036
8050748 325186 13005
8050749 325186 13038
8050750 325187 13022
8050751 325191 13022
8050752 325191 13035
I need the Output to be (Return the Operator for the MAX IDX by prodOrder):
IDX ProdOrder Operator
8050747 325184 13036
8050749 325186 13038
8050750 325187 13022
8050752 325191 13035
I have had no joy with grouping or sub-queries - i have the feeling there will be a very simple answer.