Use of Pivot

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
DS1
Charter Member
Charter Member
Posts: 29
Joined: Wed Mar 29, 2006 1:13 pm

Use of Pivot

Post by DS1 »

hello,

I am working with legacy data that doesnot have key column in a table.
beacuase of this, there are duplicate records of columns that should have only one record.

I need to apply logic such that based on the business rule, one of this record is picked for extraction.

Please let me know if we can do group rows based on key and compare to select row based on rule and drop the rest all .

Please let me know if it is possible.

Can we use pivot to convert the rows and make it horizonal columns.. and then compare the horizontal records.

thanks

-ds1
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

You can use a Pivot to make columns into Rows, based on your requirements.
-U
Thanks,
Upul
DS1
Charter Member
Charter Member
Posts: 29
Joined: Wed Mar 29, 2006 1:13 pm

Post by DS1 »

uegodawa wrote:You can use a Pivot to make columns into Rows, based on your requirements.
-U
my need is to make rows into column based on a key field
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Which is exactly what the Pivot stage does. Don't confuse "key" with "index" or "primary key" or anything of that ilk. For the Pivot stage, you mark as "Key" the base column(s) that should be included in every row it pivots out. This is all documented in the pivot.pdf manual in your Docs directory.

Just to be sure we're all on the same page, why don't you include some examples? Show us examples of this legacy data and what you need that same data to look like after the pivot / deduplication.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DS1
Charter Member
Charter Member
Posts: 29
Joined: Wed Mar 29, 2006 1:13 pm

Post by DS1 »

chulett wrote:Which is exactly what the Pivot stage does. Don't confuse "key" with "index" or "primary key" or anything of that ilk. For the Pivot stage, you mark as "Key" the base column(s) that should be included ...
i am not able to use pivot to combine multiple rows into 1 row

- DS1
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

Pivot works otherway round, it convert single row in to multiple rows.
Thanks,
Upul
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

combine multiple rows into 1 row
Sounds like a possibility for an aggregator to me.

Should we keep guessing?... or maybe you could follow-up on Craig's request...
Just to be sure we're all on the same page, why don't you include some examples? Show us examples of this legacy data and what you need that same data to look like after the pivot / deduplication.
Mike
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So a vertical rather than the horizontal pivot the stage provides. Search the forums for "vertical pivot", the technique has been discussed here a time or two. And please do provide some examples, examples do generally help as long as they are real.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply