• Hi

    GSquared

    After runnig your both the query, for set and sequece, this is what i got

    ID DateValue Prd statusid setfirst setlast setid setsequence

    12007-10-17 00:01:00.000A11011

    22007-10-17 00:02:00.000A10021

    32007-10-17 00:03:00.000A10001

    42007-10-17 00:04:00.000A10002

    52007-10-17 00:05:00.000B11003

    62007-10-17 00:06:00.000B10004

    72007-10-17 00:07:00.000B10005

    82007-10-17 00:08:00.000B20106

    92007-10-17 00:09:00.000B11007

    102007-10-17 00:10:00.000B20108

    112007-10-17 00:11:00.000A10009

    122007-10-17 00:12:00.000A100010

    132007-10-17 00:13:00.000A100011

    142007-10-17 00:14:00.000A100012

    152007-10-17 00:15:00.000A201013

    but i was looking for something like this! and setfirst was good escept for the last Prd A

    ID DateValue Prd statusid setfirst setlast setid setsequence

    12007-10-17 00:01:00.000A11011

    22007-10-17 00:02:00.000A10021

    32007-10-17 00:03:00.000A10001

    42007-10-17 00:04:00.000A10001

    52007-10-17 00:05:00.000B11001

    62007-10-17 00:06:00.000B10001

    72007-10-17 00:07:00.000B10001

    82007-10-17 00:08:00.000B20101

    92007-10-17 00:09:00.000B11002

    102007-10-17 00:10:00.000B20102

    112007-10-17 00:11:00.000A11003

    122007-10-17 00:12:00.000A10003

    132007-10-17 00:13:00.000A10003

    142007-10-17 00:14:00.000A10003

    152007-10-17 00:15:00.000A20103

    So sequence 1 is one block , Sequence two is another block and Sequence 3 is one more block

    and after acheiving this i can trap the first and last record of each sequence which is my ultimate goal

    I guess i am not messing up your labor day weekend!

    I am really excited and thrilled from your unconditional help for new guy in SQL

    Thanks

    Simon