• Pleas use the URL in my signature and have a look how to post a question in a better way. As for your question. According to the data that you gave us (id with no gaps, need the average of 2 records) you can do it this way:

    create table Demo (id int, Time datetime, value numeric(3,1))

    go

    insert into demo (id, time, value)

    select 1, '10:00:00', 4

    union select 2, '10:05:00', 6

    union select 3, '10:10:00', 3

    union select 4, '10:15:00', 7

    union select 5, '10:20:00', 8

    union select 6, '10:25:00', 2

    union select 7, '10:30:00', 4

    go

    select a.id, a.time, a.value, (a.value + isnull(b.value, a.value))/2 as AvgCurrentAndPref

    from demo as a left join demo as B on a.id = b.id+1

    go

    drop table demo

    Notice that if you have gaps in the ID column, you can use common table expression with ranking functions instead of the ID column.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/