The following series of SQL statement retrieve a record set for producing the receipts side of cash book for Model-I
(i) To find the total amount by which the cash account is debited.
In order to ascertain the total amount by which every transaction cash account has been debited, the following SQL statement is formed.
SELECT Credit AS Code, Amount, Date
FROM Vouchers
WHERE Debit Like "631∗"
This SQL Statement gives the code and amount from which cash is received. This SQL statement is saved as Query Cl.
(ii) To generate the total of Receipt side. The following SQL Statement is formed
SELECT Code Sum (Amount) AS Total
FROM Query Cl
GROUP BY Code
This SQL statement is save as Query C2
(iii) To find the record set which consist of account code, Name of account, credit amount and date. The following SQL Statement is formed.
SELECT a. code b. Name AS {Name of Account},. IIF (a=Total>0,a.Total, null AS Amount)
FROM Query C2 AS a Accounts AS b. Where a code = b code.