I have Following Table
Input Output
---------------------------------
12.22
2.22
If I pass Following Sql Statement:
Select Input,Output,Balance=sum(Input - Output) from Stock group by input,output
So The Output is:
Input Output Balance
--------------------------------------
12.22 NULL NULL
NULL 2.22 NULL
If I wants The Output Like Below:
Input Output Balance
--------------------------------------
12.22 12.22
2.22 10.00
Than What is SQL Transact Statement?
My Table Structure is as Below:
companyID int
transID int -- Primary Key (Auto Increment)
Date datetime
particulars varchar
input decimal
output decimal
Note:- I have applied here Group By function on input and Output columns which doesn't make diference as there is transID columns which is autoincrement hence it should be display all the rows of the table.
NULLbit is easy - just useCOALESCE)