How to get Only NON-consective dates?

  • Well Dears!

    Here is a table structure with data. i have to get only the non consective dates from this table how to chieve this. query is required.

    Pk(int auto) DateField

    1 02/12/2006

    2 02/13/2006

    3 02/14/2006

    4 02/15/2006

    5 02/17/2006

    6 02/19/2006

    7 02/20/2006

    8 02/22/2006

    9 02/24/2006

    10 02/25/2006

    11 02/26/2006

    12 02/27/2006

    13 02/28/2006

    Required output is

    pk DateField

    5 02/17/2006

    8 02/22/2006

    How to get this. only the non-consective dates.

    Thnx in Advance

  • select *

    from yourtable t

    where not exists (select * from yourtable x where x.DateField = t.DateField - 1)

    and not exists (select * from yourtable x where x.DateField = t.DateField + 1)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply