Home Forums SQL Server 2008 T-SQL (SS2K8) read the current row and previous row & calculate difference reporting values over RE: read the current row and previous row & calculate difference reporting values over

  • Thanks for the reply , will give the above a go.

    Sorry for poor explanation.

    Current row = the row i am querying , bearing in mind i need to query all rows per device.

    Previous row = the row prior to the one i am looking at per device.

    Arrived at 3 and 5 because when reading row 5 the value is > 20 when compared to the previous (row 4) for that devices.

    Sorry , finding it hard to explain , easier to show.

    Scott

    Edit to say, not sure is UNION is a good idea, find it very slow on + billions records.