IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Table Join with different values


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Thu Apr 18, 2013 12:19 pm
Reply with quote

Hi,

I have 2 tables which needs to be joined based on Client and Product.

However one product is AA in Table A and BB in Table B. All other products are same on both tables. Is it possible to Join A and B for AA and BB. they are both same. Please let me know.

Code:


Table A
Client    Prod
----------------
123       AA
123       XX
345       TT
567       ZZ

Table B
Client  Prod  Data
---------------------
123     BB      Product Data1
123     XX     Product Data 2
345     TT     Product Data 3

Expected output 

Client   Prod         Data
-------------------------------
123      AA/BB       Product Data1
123     XX             Product Data 2
345     TT              Product Data 3

   


Please suggest if this is feasible through a left join or some way. I tried the REPLACE command in a left join but it was not working
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Apr 18, 2013 7:56 pm
Reply with quote

Hello,

How many other mis-matched pairs might eventually need to be supported? Why is there this mis-match?

How much would it take to make this value consistent in both files?

What you want to do would be trivial in a program and would be easier to expand if the requirement "grows".
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Mon Apr 22, 2013 12:49 pm
Reply with quote

HI Dick,

looks like there was a miscommunication among team located at different locations and evantually 2 various entries came into place. I guess this is the only entry that will remain so.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts FINDREP before JOIN DFSORT/ICETOOL 3
No new posts DFSORT Join Keys Controlcard DFSORT/ICETOOL 4
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Create a specific record/file based o... SYNCSORT 8
Search our Forums:


Back to Top