Here's a fine How-do-you-do:
If I leave off the group by, I get the correct total:

sel sum(Creditamount) from Credits where Creditdate between 3/1/2008 and 3/31/2008
sum (Creditamou
--------------- 5,771.35

----- Original Message ----- From: "Bernard Lis" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, April 23, 2008 12:43 PM
Subject: [RBASE-L] - RE: Group by -- need another set of eyes


I did an Autochk -- no errors, then did a reload, saved some space, but same results?????
There has to be a gremlin someplace.

Here are the results after the reload -- but this time I also did it on the debit table as well as the credit table. The Debit table did not duplicate, only the Credit table does?

sel CreditDate,sum(Creditamount)=s from Credits where Creditdate between 3/1/2008 and 3/31/2008 group by CreditDate
CreditDate sum (Creditamou
---------- --------------- 03/23/2008 2,952.16
03/30/2008        2,819.19
03/23/2008        2,952.16
03/30/2008        2,819.19
---------- --------------- 11,542.70

R>sel DebitDate,sum(Debitamount)=s from Debits where Debitdate between 3/1/2008 and 3/31/2008 group by DebitDate
DebitDate  sum (Debitamoun
---------- --------------- 03/23/2008 825.38
03/30/2008          123.49
---------- --------------- 948.87

----- Original Message ----- From: "Sami Aaron" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, April 23, 2008 12:13 PM
Subject: [RBASE-L] - RE: Group by -- need another set of eyes


Crazy stuff!   Reload your database and see what you get then...

Sami

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bernard Lis
Sent: Wednesday, April 23, 2008 11:04 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Group by -- need another set of eyes

Hi Sami,
You mean like this:

sel CreditDate,sum(Creditamount)=s from Credits  where Creditdate between
3/1/2008 and 3/31/2008 group by CreditDate
CreditDate sum (Creditamou
---------- --------------- 03/23/2008 2,952.16
03/30/2008        2,819.19
03/23/2008        2,952.16
03/30/2008        2,819.19
---------- --------------- 11,542.70

----- Original Message ----- From: "Sami Aaron" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, April 23, 2008 11:58 AM
Subject: [RBASE-L] - RE: Group by -- need another set of eyes


Bernie -

The WHERE clause comes before the GROUP BY clause:

sel CreditDate,sum(Creditamount)=s from Credits +
 where Creditdate between 3/1/2008 and 3/31/2008 +
 group by CreditDate

Sami
____________________________
Sami Aaron
Software Management Specialists
913-915-1971
[EMAIL PROTECTED]



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bernard
Lis
Sent: Wednesday, April 23, 2008 10:52 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Group by -- need another set of eyes

Can anyone see what's wrong here?
Why is this duplicating?

CreditDate sum (Creditamou
---------- --------------- 03/23/2008 2,952.16
03/30/2008        2,819.19
03/23/2008        2,952.16
03/30/2008        2,819.19
---------- --------------- 11,542.70











Reply via email to