T-SQL to determine “out of sequence” records
问题 I am using Microsoft SQL server and I need to determine records that are "out of sequence" from a table. I'll explain through an example. I have the following table structure: OrderNumber OrderStatus EventDateTime 0001522989 22 2014-04-14 05:49:25.4414243 0001522989 26 2014-04-14 05:51:16.7047485 0001522989 23 2014-04-14 05:51:17.8602798 0001522990 23 2014-04-14 05:51:19.9603575 0001522990 24 2014-04-14 05:52:06.5803494 0001522990 24 2014-04-14 05:52:06.5803494 Now I need to produce a list of