Sunday, February 19, 2012

Appending info into a column

How would you go about adding info to a column.

ex. There are 3 tables where all of the information is the same except the last column. The last column contains different types.

The tables are formatted something like

Name|Phone|Coverage|AA
Name|Phone|Coverage|BB
Name|Phone|Coverage|CC

But I want to have one table that contains the info as

Name|Phone|Coverage|AA|BB|CC|

| = Column changeJoin (possibly outer join) the 3 tables on the common columns.|||Name|Phone|Coverage|AA|BB|CC|

But are you not going to have a record for each type here also?|||I am not even sure how to word this. I tried the join and made sure to connect all of the tables to the most important information. Then I only output the AA, BB, CC columns. So in essence I have 3 free standing columns that are based on the same ID.

Here comes the problem. How do I match these columns with their related row.

I would like to take these 3 columns and append them to the end of the row with the corresponding information.

ex. I have AA|BB|CC and have Name|Number|Date

and want to have Name|Number|Date|AA|BB|CC

(the original rows looked something like my original post description)

but not all rows that had a BB correspond to a row with AA and would I want them to end up looking like this

ex. Name|Number|Date| |BB|CC

I know this is confusing, but I think it is coherent.

Please help!

Originally posted by andrewst
Join (possibly outer join) the 3 tables on the common columns.

No comments:

Post a Comment