Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

DB2 Query -Convert multi values from column to rows

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 2 Weeks Ago   -   Original Discussion by Perlbaby
Perlbaby's Unix or Linux Image
Perlbaby Perlbaby is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 21 February 2018, 3:02 AM EST
Posts: 65
Thanks: 9
Thanked 0 Times in 0 Posts
DB2 Query -Convert multi values from column to rows

Hi Team

I am using DB2 artisan tool and struck to handle multi values present in columns that are comma(,) separated. I want to convert those column values in separate rows .

For example :


Code:
Column 1           Column2
Jan,Feb              Hold,Sell,Buy

Expected Result


Code:
Column1                 Column 2
Jan                          Hold
Feb                          Sell
[NULL] or Blank        Buy

Also column values for above will be dynamic and not restricted to just 2 or 3 values and are always comma(,) separated.
Please guide
Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago   -   Original Discussion by Perlbaby
RudiC's Unix or Linux Image
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 24 February 2018, 11:40 AM EST
Location: Aachen, Germany
Posts: 12,172
Thanks: 371
Thanked 3,754 Times in 3,449 Posts
Please clarify: Do you want
  • database tables modified or inserted using
    • db internal tools (artisan[?] / SQL / ...)
    • external tools working on query results
  • output files to be operated upon
    • with which tools
    • with which results (store / print / transfer / ...)

Last edited by RudiC; 1 Week Ago at 04:13 PM..
Sponsored Links
    #3  
Old Unix and Linux 4 Days Ago   -   Original Discussion by Perlbaby
Perlbaby's Unix or Linux Image
Perlbaby Perlbaby is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 21 February 2018, 3:02 AM EST
Posts: 65
Thanks: 9
Thanked 0 Times in 0 Posts
Hi Rudi . Thank you for the reply. Please find my answers

1.database tables modified or inserted using : DB artisan / Rapid sql
2.output files to be operated upon : Within same tool . Can be used by select query using conversion .
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert Column data values to rows Hypesslearner Shell Programming and Scripting 1 03-05-2015 06:19 AM
How to convert values in a line to rows? babom Shell Programming and Scripting 3 12-10-2013 10:38 AM
How to substract selective values in multi row, multi column file (using awk or sed?) nricardo Shell Programming and Scripting 4 10-15-2012 11:13 AM
Sort the multi column rows sandy1028 Shell Programming and Scripting 2 07-11-2010 01:06 PM
flags to suppress column output, # of rows selected in db2 sql in UNIX jerardfjay Shell Programming and Scripting 1 11-02-2005 06:48 AM



All times are GMT -4. The time now is 02:18 PM.