sql - SUM() Problem in Paradox Database -


I am currently working with a contradiction database before starting work on an existing insurance company Was applied. / P>

The long story is short that when I am trying to compile a query of all the active debit / credit balance of the client, then gives me a separate balance for each customer. Doing a query is not feasible with doing a 100K customer base and with more than 2 million transactions. So here's what I do for a single unmarried customer:

Code:

  NumberOfDebits, COUNT (Credit) as NumberOfCredit, SUM (debit) form In SELECT COUNT (debit) debit as a credit, total member transactions from credits in the form of credits where Member ID = '#### 000094';  

As I mentioned above, it gives the right balance for the member, but if I do the following:

  Select Member ID, COUNT (Credit) as NumberOfDebits, NumberOfCredit (Credit), SUM (Debit) as DebitTotal, Member Credit by MemberID (Credit) as Total Member Credit;  

This gives me a different count and yoga results for most members in the table.

Here is a table structure, so that you can understand what I have to work together and what I want to achieve is a transaction with a credit in each line or a credit in the member's account. So what I have to do, each member has to deposit each debit and credit for each member respectively. That's why this is the reason why I was thinking through this group that it will add each credit and debit to every member, but it will not do this. So how do I go about it? I have tried to get an external insertion on the name of the member from the details of the members, but still I need a group, so that I got the same result at the end

Table structure :

  Periodn I Effective Date D Entrynr + Member Slogan a Date D Journal No Reference A DtAmount N Ctmount N Statement A ModifyUserId A ModifStamp @  

One thing I have seen that after running the following Zero:

 Select as Credit Number (ACT AMOUNT), Yoga as a credit (ACTImount), as a DebitCount (COUNT) ATAtmount), SM (DTMount) as Debit, M. Member NR, M. MMNNR, M. from Premium Memex Premium; M.M.N.NRMMMNNR Group  

There is a line at the top with a member number and a huge number of calculations, debits and credits. Should be too much from any account, so I guess for some reason that the missing transactions are going on in this line for some reason.

For example, if I get a valid query with member X, 3094 debit and credit and debit calculation of 55 and credit number of 18 that matches the records in that table for that member , But when I run the above queries, then I have 2 credits count, debit count 19, 1590 credits and 2090 debit.

So I'm stumped. I do not know whether this is a contradiction problem, or my unqualified understanding of SQL.

Oh, yes, the credit number of the vacant member is 273, the debit number of 341, the 1930 credits and the debit 17168.

I do not know whether this is a contradiction problem, or an understanding of my disabled SQL.

I expected that the result for the query "single member" and the equivalent line in the "All Members" query would return the same amount and amount. If this was your hope then I do not tell the understanding of SQL as "ineligible".

It is difficult to diagnose these types of problems. You have a clue to this:

This gives me a separate count and sum for the members Most in the table (emphasis my)

< / Blockquote>

Whatever you need to do is to choose two members, where both questions return the same result and find out how they are separated from the members who have different results.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -