I've created a temp table and need to further select some data from it. Seems simple. The temp table contains thousands of orders, an action code (C or D)and a seq_ID for each order. Each order has multiple instances of the C and D action codes, but I only want a list of those where the value for the greatest seq_id is a C. So from this example, I want to include SO_ID 4055 in the list, because the greatest SEQ_ID is associated with an action code of C, but I do not want to include SO_ID 4089 because the action code associated with the max SEQ_ID for that order is a D. Do I need a self-join? a having clause? both? Thanks.
SEQ_ID ACT_COD SO_ID 1981922 C 4055 1981924 D 4055 1981925 C 4055 1981926 C 4089 1981927 D 4089
January 25, 2012 6:07 PM
February 28, 2012 11:08 AM