Page 1 of 1

Vertical pivot

Posted: Mon Dec 05, 2005 9:41 pm
by babbu9
Hi
I have a vertical pivot requirement.


Table1
col1 col2
X 2
X 3
X 4
Y 1
Y 2

Table2

col1 col2 col3 col4
X 2 3 4
Y 1 2 0

If the values in the first col1 are equal then the corresponding values in
col2 then should be mapped to table2 cloumns 2,3,4. If no values are found then it should be mapped with 0.

Please suggest.

Bob

Posted: Mon Dec 05, 2005 9:53 pm
by ray.wurlod
What did your search for "vertical pivot" on this site reveal?

Posted: Mon Dec 05, 2005 10:52 pm
by babbu9
Ray
I have gone through the vertical pivot posts on this forum but they donot specifically talk about comparing values in the first column, rather they are simple vertical pivots.

If would appreciate if you could help me in this regard.

Thanks

Posted: Mon Dec 05, 2005 11:35 pm
by roy
Hi,
Sounds like a simple vertical pivot + filtering on the results to me.

Posted: Mon Dec 05, 2005 11:48 pm
by ray.wurlod
There is a very simple approach using stage variables. It may be posted on the server forum, but it will work just as well in parallel jobs. You just have to make sure that the data are partitioned on the first column values so that all values of each distinct value are on the one partition.