SQL Query help

  • Hi

    Please ignore

    thanks in advance...

  • Guys please help me out.. atleast suggest me an idea..Thanks

  • Here is an article about linking to previous row. See if this can help.

    http://www.sqlservercentral.com/articles/T-SQL/62159/

    --Vadim.

    --Vadim R.

  • Thanks for the example, it was helpful to an extent, though did solve the complete problem.. I need a way to check the next an previous row values depending on another column .. In the example below since ID's 3,4 are 0's and rows below and down are 100, i should ignore/delete those fields i.e.,3 and 4... also, if the rows above and below are not equal to 100 like for rows 6,7,8,9... i should consider all the values while doing other calculations ..so i need a way to look at the above/below rows..

    Id DID Value date

    1 1 100 2010-03-10

    2 1 100 2010-03-10

    3 1 0 2010-03-10

    4 1 0 2010-03-10

    5 1 100 2010-03-10

    6 1 100 2010-03-10

    7 1 0 2010-03-10

    8 1 0 2010-03-10

    9 1 20 2010-03-10

Viewing 4 posts - 1 through 3 (of 3 total)

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