Re: consolidation of multiple rows

From: hpuxrac <johnbhurley_at_sbcglobal.net>
Date: Wed, 5 Mar 2008 12:08:43 -0800 (PST)
Message-ID: <2fcaf695-bbcc-4636-aab1-2575dac86513@q33g2000hsh.googlegroups.com>


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. Received on Wed Mar 05 2008 - 14:08:43 CST

Original text of this message