Query to make a separate column to differentiate over by over difference? create table test1(overs int,runs int) insert into test1 values(1,10) insert into test1 values(2,17) insert into test1 values(3,20) insert into test1 values (4,32) insert into test1 values(5,38) O/P === Overs runs difference 1 10 NULL 2 17 7 3 20 3 4 32 12 5 38 6 What I have tried: please any one give me the Query to achieve this above Requirement.
SELECT Overs, Runs, Runs - LAG(Runs, 1, NULL) OVER (ORDER BY Overs) AS [Difference] FROM test1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)