Hello, I'd appreciate some help regarding user-written base code. Consider the following example input table, which is filtered on ORDER_NO=4687: ORDER_NO ORDER_SEQ_NO ORDER_STATUS COMMENT DATE 4687 1 OPP 15SEP2011 4687 2 FIN 27SEP2011 4687 3 AB 05OCT2011 4687 4 FIN 06OCT2011 4687 5 FIN Hello world! 27JAN2014 Each time a change is made to an order, a new row is triggered (the one with the highest ORDER_SEQ_NO being the most recent). This ideally only happens when the order status changes. However, if a consultant manually edits the order (here by adding a comment), another row is triggered despite the status not having changed. So far, my job has always selected the date from the most recent row (27JAN2014), i.e. from the row with the highest ORDER_SEQ_NO. However, I need it to select the first date for the most recently triggered order status. So, in the example above, the logic should select the date 06OCT2011. Not 27SEP2011, as there's been a different status since back then. I can't simply group by the most recent ORDER_STATUS and select min(DATE), as that would select the date from row 2. I need row 4 from this example, and of course I can't just select ORDER_SEQ_NO=4 directly since the logic must apply to numerous other orders as well.
... View more