Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Table Join with different values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Table Join with different values
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

Site Director


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

PostPosted: Thu Apr 18, 2013 7:56 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us