i have to show running total with the total column in my application ... so i have used the fol
I think you will find the recursive CTE a bit faster.
;with C as
(
select t.ind,
t.col1,
t.col1 as Total
from @tmp as t
where t.ind = 1
union all
select t.ind,
t.col1,
C.Total + t.col1 as Total
from @tmp as t
inner join C
on C.ind + 1 = t.ind
)
select C.col1,
C.Total
from C
any other method by which is more faster
Yes there is. If you are looking for outstanding performance you should just pull your data in a simple select and do the running total calculation on the client when you do the presentation.