Aniket Narvankar

Aniket Narvankar

  • 548
  • 2.1k
  • 613k

This Question is related to SQL

Feb 7 2025 7:17 AM

Name Pan Value

A1 abc 5

A1 abc 5

B1 xyz 10

B2 def 10

C1 ghi 20

C1 klm 20

D1 mno 30

D1 mno 30

i want to calculate running total for same pan and same name
Name Pan Sum Total

A1 abc 5 5

A1 abc 5 10

B1 xyz 10 10

B2 def 10 10

C1 ghi 20 20

C1 klm 20 20

D1 mno 30 30

D1 mno 30 60

I tried with this query
Select Name,Pan,val,sum(val) over (Partition by Name,Pan order by Name,Pan) as total
but this did not work
it gave total for same pan and name. in total column o/p came as
10
10
10
10
20
20
60
60
please can any one suggest how this can be achieved


Answers (3)