G
Guest
I am translating an Access Database into a DataProject using SQL Server as
the database. I have a query with the following code
SELECT Sum(IIf([Date]<[Date1],[Amount],0)) AS OpeningBalance, Sum(IIf([Date]
Between [Date1] And [Date2] And [PaymRec]="Receipt",[Amount],0)) AS Receipts,
Sum(IIf([Date] Between [Date1] And [Date2] And
[PaymRec]="Payment",[Amount],0)) AS Payments,
Sum(IIf([Date]<=[Date2],[Amount],0)) AS ClosingBalance
FROM CashBook;
Esentially what it does is return OpenningBalance, Receipts Payments and
ClosingBalance for a CashBook table.
Does anyone have any suggestions as to the best way to build a strored
procedure that can produce the same results.
the database. I have a query with the following code
SELECT Sum(IIf([Date]<[Date1],[Amount],0)) AS OpeningBalance, Sum(IIf([Date]
Between [Date1] And [Date2] And [PaymRec]="Receipt",[Amount],0)) AS Receipts,
Sum(IIf([Date] Between [Date1] And [Date2] And
[PaymRec]="Payment",[Amount],0)) AS Payments,
Sum(IIf([Date]<=[Date2],[Amount],0)) AS ClosingBalance
FROM CashBook;
Esentially what it does is return OpenningBalance, Receipts Payments and
ClosingBalance for a CashBook table.
Does anyone have any suggestions as to the best way to build a strored
procedure that can produce the same results.