Oooops, sorry!! Misunderstood the query completely...here's another take:DECLARE @table table (Ename varchar(1), Salary int)
INSERT INTO @table
SELECT 'A', 15000 UNION ALL SELECT 'B', 10000 UNION ALL
SELECT 'C', 20000 UNION ALL SELECT 'D', 45000
SELECT Ename, Salary, Cu_sal =
(SELECT SUM(Salary) AS Cu_sal
FROM @table b
WHERE b.Ename <= a.Ename)
FROM @table aDon't think this is possible without a subquery...but maybe some of the geniouses here say differently...
--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"