View previous topic :: View next topic |
Author |
Message |
vijay_bc Beginner
Joined: 22 Aug 2006 Posts: 4 Topics: 2
|
Posted: Sun May 13, 2007 8:02 am Post subject: Unload using Joins from DB2 table |
|
|
Hi..
Is it possible to use Join in UNload utility while extracting data from DB2 tables as below? KEY1 being common in both tables. This syntax fails saying select is invalid. Can u suggest any options if there is?
Code: |
//DSNUPROC.SYSIN DD *
UNLOAD DATA
FROM TABLE table1
WHEN ( KEY1 IN (SELECT KEY1 FROM TABLE2
WHERE KEY2 = 'XYZ'));
|
|
|
Back to top |
|
 |
bauer Intermediate
Joined: 10 Oct 2003 Posts: 317 Topics: 50 Location: Germany
|
Posted: Mon May 14, 2007 1:27 am Post subject: |
|
|
vijay_bc,
create a view with the desired unload condition and do the unload using the view.
bauer |
|
Back to top |
|
 |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Mon May 14, 2007 6:23 am Post subject: |
|
|
You should use the keyword WHERE instead of WHEN.
regards
Christian |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|