Whenever there is a debit/credit transaction from bank..it is recorded in bankTransaction table and BankBalance is updated in banks table...
I want to have ALL BANKS CREDITs on a specific date
My query is
(SELECT bTr.BankCode,SUM(CONVERT(money,bTr.Amount)) FROM benkTransaction bTr WHERE
bTr.DebitCreditCheck='CREDIT' AND bTr.[Date]<='7/16/2010' GROUP BY bTr.BankCode);
The problem is that If there is no transaction happened on or before this date ..there is no result.... I want it to be 0.00 if no transaction ever happened ...and the balance if some transaction happened before this period
left outer join BankTransaction
on Banks.BankCode = BankTransaction.BankCode
GROUP BY Banks.BankCode
*Typos corrected and superfluous obfuscating table aliases removed.
If it's not practically useful, then it's practically useless.