• akberali67 (3/20/2013)


    CTE wouldnt work because I am joining the table to itself meaning the field names would be the same and SQL doesnot accept that.

    davidandrews13 (3/20/2013)


    are you doing something that a Recursive CTE could resolve?

    http://blog.sqlauthority.com/2008/07/28/sql-server-simple-example-of-recursive-cte/%5B/quote%5D%5B/quote%5D

    sql handles that just fine as long as you rememeber to preface every field with it's table name.

    SELECT

    T1.*

    T2.*

    FROM MyTable T1

    LEFT OUTER JOIN MyTable T2 On T1.ID = T2.ID +1

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!