Hello All,
I'm currently working with a paradox database that was implemented before I started working at my current job at an insurance firm.
Long story short is that when I am trying to to compile a query of the debit/credit balances of all the active clients, it gives me a different balance per client if I do a query for each individual client. With a client base of a 100K and with a number of transactions over 2 million it isn't viable to do so. So here is what I do for an indiviudal client:
Code:
SELECT COUNT(Debit) as NumberOfDebits, COUNT(Credit) as NumberOfCredit, SUM(Debit) as DebitTotal, SUM(Credit) as CreditTotal
FROM MemberTransactions
WHERE MemberID = '####000094';
As I mentioned above, this gives the right balances for the member, but if I do the following:
Code:
SELECT MemberID,COUNT(Debit) as NumberOfDebits, COUNT(Credit) as NumberOfCredit, SUM(Debit) as DebitTotal, SUM(Credit) as CreditTotal
FROM MemberTransactions
GROUP BY MemberID;
It gives me both a different count and sum results for most the members in the table.
Would anyone have an idea why the sum() and count() would be different with the second query?
Thanks a lot in advance
|