Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL count problem

Re: SQL count problem

From: Glen Siferd <siferd_at_admin.uwex.edu>
Date: Fri, 14 Jan 2000 10:33:25 -0600
Message-ID: <85nj4q$31pq$1@news.doit.wisc.edu>


Your example seems incorrect, but is this what you're looking for?:

SQL> SELECT
  2 A.REGNR , COUNT(A.REGNR) frequency, SUM(A.AMOUNT) tot_amount   3 FROM
  4 TEST A
  5 group by a.regnr
  6
SQL> /     REGNR FREQUENCY TOT_AMOUNT

SQL>
> Frank Heijmans <no_ftgh_at_xs4all.nl_spam> wrote in message
> news:387deca0.26725177_at_news.xs4all.nl...
> > Hi,
> >
> > I am looking for an SQL solution to do a frequency count
> > on a table. My table could look like this:
> >
> > regnr amount
> > -------------------------------
> > 123 100.00
> > 345 50.00
> > 456 60.00
> > 123 25.00
> > 456 15.00
> > 123 200.00
> >
> >
> > The count should give me the following result
> >
> > frequency tot_amount
> > --------------------------------
> > 3 225.00
> > 2 85.00
> > 1 15.00
> >
> >
> > Is this possible in one query? If so, can someone help me?
Received on Fri Jan 14 2000 - 10:33:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US