• Michael Meierruth (1/31/2014)


    OK, just saw your use of LAG which means SS20012.

    But you're making completely wrong use of it.

    If you delete one of the rows with cgm='5' from your data and run your script the results become a lot worse.

    In your final select display the dr column and you'll see this right away.

    Also, no dense_rank needed here. Rank is sufficient.

    It's not completely wrong - it's getting me all the test data except one row how I want it. Do you have another suggestion?

    Switching from dense rank to rank doesn't change output, so I'm not sure what you mean.

    Thanks