I have table called “Factory1” (MS SQL Server) containing columns LOT and Counter:
LOT Counter
87888 0
… …
87888 345768
87889 0
… …
87889 560787
etc.
During the shift, at the end of every batch the counter is reset. I have to write query showing the running (and finished batches if any) and the corresponding counter values at the end of every shift. Any hints?