Then you could approach it this way by means of a view: CREATE TEMPORARY VIEW BUDGET_SUM (ACCOUNT,BUDGET) AS SELECT DISTINCT ACCOUNT,BUDGET FROM <TABLENAME>
Then go back and do: SELECT ACCOUNT,SUM(BUDGET) FROM BUDGET_SUM GROUP BY ACCOUNT This will give you the sum of the unique account/budget combinations not the the total budget amounts. Hope this helps. Mike Ramsour -----Original Message----- From: Atrix Wolfe [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: Re: newbie sql question sorry, i didnt phrase my question correctly. If i have: Account Budget 1 30 1 30 2 40 2 40 3 20 3 20 i want the sum of the distinct account budgets...IE: 30+40+20=90 so i want it to display 90 as the result. Is this doable? ----- Original Message ----- From: randyp To: [EMAIL PROTECTED] Sent: Thursday, October 10, 2002 12:26 PM Subject: Re: newbie sql question SELECT account, SUM(budget) from [tableName] group by account. This will show you the sum of however many budget amounts for each distinct account. Account Budget 1 $ 200 1 300 2 100 will result in: 1 $ 500 2 100 If you use SUM(budget)=s the total of $ 600 will be listed underneath the individual budget subtotals. Randy Peterson ----- Original Message ----- From: Atrix Wolfe To: [EMAIL PROTECTED] Sent: Thursday, October 10, 2002 2:39 PM 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/
