Atrix:

Here's the solution:

SELECT ACCOUNT,SUM(BUDGET) FROM <TABLENAME> GROUP BY ACCOUNT

The key operator here is the GROUP BY which effectively gives a distinct
listing of the accounts.  For even more info you can do this:

SELECT
ACCOUNT,COUNT(ACCOUNT),SUM(BUDGET)=s,MIN(BUDGET),MAX(BUDGET),AVG(BUDGET)
FROM <TABLE> GROUP BY ACCOUNT

The =s on SUM(BUDGET) will additionally give you a grand total.

Be sure to have fun.

Mike Ramsour
Voice:  1-740-829-4340

-----Original Message-----
From: Atrix Wolfe [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 2:40 PM
To: [EMAIL PROTECTED]
Subject: newbie sql question






i know this is more of an sql question (and a newbie one at that) than an
rbase question but im having a problem tryin to figure
this out.

I have a table with 2 columns...1 is Account and the other is Budget.  What
i need is a sum of Budget, but there are duplicate
entries so i need it to sum Budget where Account is distinct.  Anyone know
how to do this?

thanx for the help!
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to