Skip to content
Advertisement

Subtract sum of column from a column in sql

I am inserting First four column multiple times, with new paidVal . Now I want to get sid,snameVal, balance

I have used a inner join on studenttbl and feetlb.

here I have tried. But I am getting 3 row when I should get 2 only. In the table there is a field cNameVal, and as much different value i m entering I am getting that much row.

feetbl

Advertisement

Answer

With no expected results, this is based on this comment:

I want to get sid,snameVal, balance here balance means courseFeeVal - SUM(paidVal)'

Seems like you want a windowed SUM:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement