declare @t table ( id int, SomeNumt int ) insert into @t select 1,10 union select 2,12 union select 3,3 union select 4,15 union select 5,23
Without using any type of JOIN cumulative salary for a person fetch by using follow query:
SELECT * , ( SELECT SUM( salary ) FROM `abc` AS table1 WHERE table1.ID <= `abc`.ID AND table1.name = `abc`.Name ) AS cum FROM `abc` ORDER BY Name