Re: Calculating SUM and COUNT in one statement

From: amit <amit.poddar_at_yale.edu>
Date: 23 Feb 2004 13:00:15 -0800
Message-ID: <9db1b842.0402231300.1567c573_at_posting.google.com>


ford_desperado_at_yahoo.com (Ford Desperado) wrote in message news:<e96bc0d0.0402211436.5e27ebc7_at_posting.google.com>...
> Hi,
>
> I need to retrieve
> 1. a total
> SELECT SUM(COL1) FROM SOME_TABLE
> 2. most frequent values
> SELECT COL1, COUNT(*) FROM SOME_TABLE GROUP BY COL1
>
> I want to scan the table only once, so I was trying to accomplish both
> tasks in one statement. It's Oracle 9i
> Any ideas?
> TIA
How about:

select col1,sum(col1),count(*)
from some table
group by col1 Received on Mon Feb 23 2004 - 22:00:15 CET

Original text of this message