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: Totaling by group

Re: Totaling by group

From: TurkBear <johng_at_mm.com>
Date: Wed, 25 Aug 1999 14:54:22 GMT
Message-ID: <37c402b7.4447875@news.news-ituk.to>


"Ci-Ci Mills" <cici_at_erols.com> wrote:

>Let's say there is a database that keeps track of customers that buy a
>specific product...say DVD's.
>There is a table which holds member information (member #,
>premiere_member,name, address, city, etc.) and a view which samples info
>about each member account (using the handy-dandy decode function) and
>returns info like total # of orders by premiere_member, total # of orders by
>non-premiere members,etc.).
>
>I have a report (in SQR) that shows the totals grouped by city....no
>problem.
>Now, I want a report that shows the totals by household...a household is
>defined by the last name, address and city. So, even if there are three
>people with the same last name, address and city that have ordered, this
>only counts as 1.
>
>I hope this makes sense. Any ideas out there?
>
>Thanks,
>A. Mills
>cici_at_erols.com
>

Try:

Select distinct rtrim(name)||rtrim(address)||rtrim(city) household,count(orders)

from member_table
group by household;

>
>
>
>

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------    http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- Received on Wed Aug 25 1999 - 09:54:22 CDT

Original text of this message

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