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: Question about writing Oracle reports and compute counts

Re: Question about writing Oracle reports and compute counts

From: Jon Yi <joycompu_at_yahoo.com>
Date: Tue, 27 Aug 2002 14:17:29 GMT
Message-ID: <ZRLa9.29661$3V5.9105@nwrddc02.gnilink.net>


You need to use aggregate function "count(*)" in select statement. Use "group by " not "order by". Also use "group by sender3, inq_type" to get the output you want.
These are basics of SQL. You will want to read before posting to avoid nasties.
-Jon
"gail" <gailbuf_at_hotmail.com> wrote in message news:a61820ad.0208270534.12010dfa_at_posting.google.com...
> Hi,
>
> I would really appreciate your help with this one:
>
> I have a table which has the following fields (among others):
>
> sender3 varchar2(20)
> inq_type varchars2(20)
>
> what i need is a report that will list the count of each transaction
> type (inq_type) for each sender:
>
> sample output should be something like:
>
> SENDER1
>
> TRANS_TYPE_1 20
> TRANS_TYPE_2 50
>
> SENDER2
>
> TRANS_TYPE_2 25
> TRANS_TYPE_3 10
>
>
> Here is what I've tried:
>
> ttitle 'Sender Transaction|Report'
> btitle 'Confidential'
> break on sender3 skip 2
> COMPUTE count of inq_type ON sender3
>
>
> column sender3 HEADING 'Sender' FORMAT A20
> --column inq_type HEADING 'Transaction Type' FORMAT A20
> select sender3,inq_type
> from gail_trans_log
> order by sender3,inq_type
>
>
> This will just give me the total count for each sender, not broken
> down by transaction type. It also lists each individual transaction,
> all i want is the total count for each transaction type per sender.
>
> Any help would be much appreciated!
>
> Thanks in advance,
>
> Gail Buffington

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/02
Received on Tue Aug 27 2002 - 09:17:29 CDT

Original text of this message

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