Check sequential order of status of items

  • There is a table tblItems with below structure ( i cannot change the below table structure)

    Objective is to check if the sequential order of the statuses is correct or not.

    Order of the statuses should be in this sequence : QualityCheck, Printing, Labelling, Packing, Dispatch

    If the status is not in this order for any item then we need to print such items.

    Eg: item id 102 in below table in not correct as initially quality check should have been done hence print out 102.

     

  • Can you provide your sample data in consumable format, please? Here is some skeleton code to help you get started.

    DROP TABLE IF EXISTS #tblItems;

    CREATE TABLE #tblItems (Rownr INT, ...)

    INSERT #tblItems
    (
    Rownr, ...
    )
    VALUES
    (1, ...
    ), (2, ...)

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply