Re: consolidation of multiple rows

From: hpuxrac <johnbhurley_at_sbcglobal.net>
Date: Thu, 6 Mar 2008 15:39:31 -0800 (PST)
Message-ID: <f89709f6-095b-419c-9905-6014c2f479d9@m36g2000hse.googlegroups.com>


On Mar 5, 4:38 pm, DA Morgan <damor..._at_psoug.org> wrote:
> hpuxrac wrote:
> > On Mar 5, 12:49 pm, --CELKO-- <jcelko..._at_earthlink.net> wrote:
> >> 1) If two of the rows in your raw data staging table have different
> >> values for the same attribute, say a phone number, which one do you
> >> pick or does it matter?  If not, then use this skeleton:
>
> >> SELECT company_name, MAX(phone_nbr), MAX(..), ..
> >>   FROM RawData
> >>  GROUP BY company_name;
>
> >> else find the conflicts:
>
> >> SELECT company_name AS conflicting_data
> >>   FROM RawData
> >>  GROUP BY company_name
> >> HAVING COALESCE (NULLIF(COUNT (DISTINCT phone_nbr), 1), NULLIF(COUNT
> >> (DISTINCT ..), 1), .. ) IS NOT NULL ;
>
> > Makes sense ...  perhaps the OP can give us some more background of
> > how and why info gets into the raw table.
>
> >> There are a lot of games we can play with a HAVING clause on the raw
> >> data.  You might want to get a copy of THINKING IN SETS and look at
> >> Chapter 10, "Scrubbing Data with Non-1NF Tables" for some more
> >> ideas.
>
> > What is "Thinking in sets"? and who wrote it ... not familiar with
> > that title.
>
> Thinking In Sets was written by Joe Celko.
>
> If you know the names Date and Codd you should know who you are
> addressing: Joe Celko.

Not a name I am familiar with.

> --
> Daniel A. Morgan
> Oracle Ace Director & Instructor
> University of Washington
> damor..._at_x.washington.edu (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org

But at least you got to put your url out again eh? Received on Thu Mar 06 2008 - 17:39:31 CST

Original text of this message