Re: Exploding information to flatness
Date: Fri, 19 Apr 2002 11:29:15 +0200
Message-ID: <3CBFE36B.858FBEA5_at_nl.ibm>
Todd Benson wrote:
> Is there an acceptable way to 'blow' out information into a flat file
> from tables that are related? In this particular case, I'm trying to
> move related data from tables to an Excel spreadsheet. Here would be
> a simplified example:
>
> create table user (
> id int primary key,
> name varchar(50)
> )
>
> create table group (
> id int primary key,
> name varchar(50)
> )
>
> create table member (
> user int,
> group int,
> primary key( user, group )
> )
>
> Obviously, 'user' to 'group' is a many-many relationship.
>
> I want to rotate out the groups into 'apparent' attributes for each
> user row in the spreadsheet. In other words, I want my rows from my
> select statement to look like this with 4 to n columns:
>
> user.name group[1].name group[2].name group[3].name ...
>
> where group[1], group[2], and group[3] are columns for all the groups
> that exist, but will have values of NULL for which the user is not a
> member.
>
> Anyone have experience with this?
>
> Thanks,
> Todd
-- Anton Versteeg DB2 Specialist IBM NetherlandsReceived on Fri Apr 19 2002 - 11:29:15 CEST