PDA

View Full Version : how can I do with two differ table by cartesian operation transform to one table



MattCasters
04-11-2006, 10:18 PM
Hi Lin,

You can just use a lookup for that, either DB Lookup or Stream Lookup.
It hardly seems like you want to do a Cartesian product, but in case you want, you can always use DB Join to allow it.

Hope this helps,
Matt

kettle_anonymous
04-12-2006, 12:38 AM
can you give me some example for using DB lookup? I can't get the result which I want. thank you!

MattCasters
04-12-2006, 12:42 AM
Attachment: dblookup.jpg (http://forums.pentaho.org/archived_att/kettle/dblookup.jpg) (Posted by user linpch, set to Plain text type)

I want to test as following:
one table:
id role
1 manager
2 employee
3 employer


the other table:
id person role
1 mary 1
2 hello 2
3 linpch 3
4 www 3

I want the result table:
id person rolename
1 mary manager
2 hello employee
3 linpch employer
4 www employer

MattCasters
04-12-2006, 12:47 AM
Attachment: dblookup.jpg (http://forums.pentaho.org/archived_att/kettle/dblookup.jpg) A generic sample can't be given, but see the attachement image.
It's based on having an input from the "Other Table" (PersonTable) having a field called RoleID.

So, you would have 3 steps: Table Input, DB Lookup and Table Output.

HTH,
Matt

linpch
04-12-2006, 05:46 AM
thank you! matt.