Concatenation of row data into a single row

Hi,
I have table which has the data in the following way.
  col1          col2    col3
  a             1       one
  a             2       two
  a             3       three
  b             1       dfdf
  b             2       sfdhh
  c             1       zgdhi want data in the following way.
  col1          col2    col3
  a             1,2,3   one,two,three
  b             1,2     dfdf,sfdhh
  c             1       zgdhCan any body help me.
Thanks in advance

may be this will work
WITH tab AS
      (SELECT 'A' col1,1 col2, 'one' col3 FROM dual
       UNION ALL
       SELECT 'A' col1,2 col2, 'two' col3 FROM dual
       UNION ALL
       SELECT 'A' col1,3 col2, 'three' col3 FROM dual
       union all
       SELECT 'B' col1,1 col2, 'abc' col3 FROM dual
       UNION ALL
       SELECT 'B' col1,2 col2, 'defg' col3 FROM dual
       UNION ALL
       SELECT 'C' col1,1 col2, 'hijcol' FROM dual
       union all
       SELECT 'C' col1,2 col2,'klm' col3 FROM dual
       SELECT col1
     , ltrim(MAX(SYS_CONNECT_BY_PATH(col2,','))
       KEEP (DENSE_RANK LAST ORDER BY curr),',') AS col2,
       ltrim(MAX(SYS_CONNECT_BY_PATH(col3,','))
       KEEP (DENSE_RANK LAST ORDER BY curr),',')as col3
FROM   ( SELECT col1
              , col2,col3
              , ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) AS curr
              , ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) -1 AS prev
         FROM   tab )
GROUP BY col1
CONNECT BY prev = PRIOR curr AND col1 = PRIOR col1
START WITH curr = 1;
COL1     COL2     COL3
A     1,2,3     one,two,three
B     1,2     abc,defg
C     1,2     hijcol,klm

Similar Messages

  • How to store array of data into a single row of  table ,using any of Stmts

    HI Friends,
    Based on my requirements ,i have retrived a set of data from a XXX.jsp page using a request.getParameter() and stored into single dimenssional array . Now i am paassing that array to JAVA class to store a into some table .
    In JSP page users can add text boxes dynamically based on his intrest then those attributes will store in table .it means table attributes are not conatant , it table attributes may change at any time when user adds any textboxs or any fields on JSP page ....thats my module ..
    Now i wanted to store all array of data into Table in a single row .......thats is my requirements .
    How can we use prepareStatement and Statement to store array of results intoo table row ...on each iteration i wanted to store array of results into table atributes ..It means entire array of results should to into table row at time .....coule any one write sytax ,how we do this...
    could any one suggest me stps that i can impliment ......?....please reply ASAP

    Well ..you code can be works for constant number of attributes in table .oopss here my requirement is table attributes not fixed ,we cant put constant number of place holder(? ) in a statement ,because those are not fixed ,
    Let me explain here :
    i am doing in that way only. As i mentioned you Table attributes are not constant .It may very if users add any fields dynamically on JSP page .If users have option to add any text box on Jsp page ,then that attribute will store in table as a attribute .
    Now i amable fetching the all dyamic form data and stored in a Result Array below ...in this iteration all form result data are from jsp page as suggestion form ,it should stored in table in single row on corrsponding attribtes ......next time when users fills FROM ,then those data i am fetching and storing in a Result Array as below and need to store in corrsponding table attributes in a single row ....
    for(int i=0;i<result.length;i++)
                   System.out.println(result);
                   pst3=connection.prepareStatement("insert into *emprecord* values(?)");
                   if(!result[i].equals(""))
                        System.out.println(result[i]);
                             pst3.setString(1,result[i]);
                             pst3.executeUpdate();
    Thnks in advance ....let me know the the way we can store dynamic form data into dyanamic table ...

  • Merging 2 rows data into a single column in OBIEE

    Hi All,
    Requirement is "Merging 2 rows into a single column"
    Scenario: data from table called "transactions_table"
    Id
    transaction no
    transaction name -------------------------------quantity
    100
    1
    abc
    1000
    100
    2
    def
    2000
    Required out put:
    Id
    Transactions & Quantity
    100
    abc(1000),def(2000)
    Please provide me solution, and let me know if any additional information is required.
    Thanks in advance to all of you.

    can you please share your data like below
    column1, column2 .....
    and where are you trying to do this? at answer or bi admin tool?
    there are a few ways to do this.

  • Merging 2 rows data into a single column in OBIEE 11g

    Hi All,
    Requirement is "Merging 2 rows into a single column"
    Scenario: data from table called *"transactions_table"*
    Id  ------------- transaction no -----------------------  transaction name -------------------------------quantity
    100 ----------- 1 ----------------------- abc ------------------------------ 1000
    100 ----------- 2 ------------------------ def ------------------------------ 2000
    Required out put:
    Id ----------------- Transactions & Quantity
    100 -------------- abc(1000),def(2000)
    Please provide me solution, and let me know if any additional information is required.
    Thanks in advance to all of you.
    Regards,
    chrs

    check the below link, that may help you.
    Re: Horizontal value display
    If it is helpful, please mark as correct or helpful

  • Using sql load insert multiple fields data into a single column in database

    Hi ,
    I have my log file in sun OS box something like this
    =======
    (07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
    (07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
    (07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
    =============
    I am trying to insert the data into oracle data base as follows.
    =============================
    column1 : (07/29/2009 00:02:24.467)
    column2 : 367518
    column3 : (07/29/2009 00:02:26.214)
    column4 : 949384011
    ===========================
    Can anyone help me with the control file format?
    someone suggested me the code below.
    ==========
    LOAD DATA
    INFILE 'D:\work\load.txt'
    INTO TABLE sample
    (col1 POSITION(02:24) char,
    col2 POSITION(27:32) INTEGER EXTERNAL,
    col3 POSITION(35:57) CHAR,
    col4 POSITION(60:68) INTEGER EXTERNAL
    ===========
    but this works only for the fixed length data? Please help

    user11744904 wrote:
    Hi ,
    I have my log file in sun OS box something like this
    =======
    (07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
    (07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
    (07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
    =============
    I am trying to insert the data into oracle data base as follows.
    =============================
    column1 : (07/29/2009 00:02:24.467)
    column2 : 367518
    column3 : (07/29/2009 00:02:26.214)
    column4 : 949384011
    ===========================
    Can anyone help me with the control file format?
    someone suggested me the code below.
    ==========
    LOAD DATA
    INFILE 'D:\work\load.txt'
    INTO TABLE sample
    (col1 POSITION(02:24) char,
    col2 POSITION(27:32) INTEGER EXTERNAL,
    col3 POSITION(35:57) CHAR,
    col4 POSITION(60:68) INTEGER EXTERNAL
    ===========
    but this works only for the fixed length data? Please helpIs the requirement to load all data in a single column or multiple columns? The thread subject and body are conflicting.

  • How to process multiple rows of data into a single string

    Hello,
    I am trying to process multiple rows of text from an Oracle database into one field to display on a report as continuous text. Below is sample data. The text field is 55 characters wide so anything longer is broken into multiple rows. I need to recombine it for display.
    line          text
    1             IN THE N.E. QUADRANT OF THE INTERSECTION OF THE FAIRFAX
    2              COUNTY PARKWAY AND THE DULLES AIRPORT ACCESS AND THE T
    3             OLL ROAD AND SOUTH OF SUNSET HILLS ROAD
    I tried creating a formula field but it did not work, below is the code in Visual Basic syntax. I also tried using the Maximum() and UBound() functions without luck. I don't quite understand how to make the UBound() work; it threw a lot of errors.
    Dim i As Number
    Dim strLocDesc As String
    For i = 1 To count({LDS_AR_RL_COMM.ART_LINE_NUM})
        strLocDesc = strLocDesc & {LDS_AR_RL_COMM.ART_COMM_RMK}(i)
    Next i
    formula = strLocDesc
    Any ideas on how to solve this?

    Hello Allison,
    You can try this:
    Create a formula called @StoreText, place it in the details and have the following code in it:
    WhilePrintingRecords;
    Global StringVar Text1;
    Global StringVar TextRest;
    if {field.line} = 1 then
    Text1:= {field.text} else
    if {field.line} >= 2 then
    TextRest := TextRest+" "+{field.text};
    In the Group Footer you can have a formula called @GetStoreText with the following code in it:
    WhilePrintingRecords;
    Global StringVar Text1;
    Global StringVar TextRest;
    Text1+varTextRest;
    See how that works out for you.
    Regards,
    Zack

  • How to display appcmd /config xml data into a single table

    Hi,
    I extracted my IIS sites using appcmd
    appcmd /site /config /xml > c:\temp\iisconfig.xml
    afterwhich I would like to grab the data from this xml and export into excel file
    [xml]$iisconfig = get-content c:\temp\iisconfig.xml
    I would like to get the Site Name, Bindings, Physical Directory Path and AppPool from this xml file and output to a excel file
    #Physical Path Directory
    $iisPhysicalPath = $iisconfig.appcmd.site.site.application.VirtualDirectory.PhysicalPath
    #Application Pool
    $iisAppPool = $iisconfig.appcmd.site.site.application.applicationPool
    #Site Details (Site Name, Binding)
    $iisSite = $iisconfig.appcmd.site
    It doesn't have a single command to output into a table. How do I combine all these code and display in a single table?
    Jeron

    Try it like this:
    $sites=[xml](c:\windows\system32\inetsrv\appcmd.exe list site  /xml)
    $sites.appcmd.site
    \_(ツ)_/

  • Rolling up data into a single report, CRMOD just cannot do it?

    So far as I've learnt, CRMOD is unable to do reports such as this and I'm hoping someone will correct me as I find it to be quite a crippling deficiency in terms of flexibility in delivery reports that clients want.
    Take this example of an ERD:
    http://img215.imageshack.us/img215/1574/erdg.jpg
    Portfolio would be a Custom Object 1, Account Allocation and Financial Info would be Custom Object 4 and 5 let's say.
    Portfolio to Account Allocation is a many-to-many relationship, hence the intermediate Account Allocation object which also has fields of its own.
    As far as I know, I will not be able to report on, an aggregate of all the financial info (e.g. SUM of a currency field in Financial Info) of all the accounts associated to a portfolio. Because of the way CRMOD reports tries to make a link between ALL objects in a single report, putting all 4 together won't work since Financial Info is not in any way linked directly to Portfolio or Account Allocation.
    I know I can link Portfolio to Account Allocation and Account (with the metric from Account Allocation), but then I cannot bring in Financial Info at the same time.

    I am aware of the Portfolio object in the GWM vertical, I was just using it as an example entity to show how the relationships are. :)
    I've used Combined Analysis many times before, but it will not help for a situation like this.
    But yeah, just seeing if any new workarounds to this have come up recently. Personally I find this to be one of the biggest deficiencies with the CRMOD reporting engine.
    It would be great if they would just provide an option to write Oracle PL/SQL code to pull data out from tables ourselves sometimes, then we can specify our own INNER/OUTER joins haha. :D

  • Putting a massive amount of data into a single variable

    I'm running a command to find the amount of space .xar files (it's a Citrix temp file of sort) are using on my organization's main file server. The server itself presents quite a few terabytes of data and all our user's profile folders are there, so we're
    talking about many thousands of folders with a whole mess of files. The command I was using is the following:
    (gci w: -r -force -include *.xar | measure -sum -property Length).Sum
    It took a long time to run, at least 5 hours, but it was finished when I got back to my desk this morning. Turns out we have 63 gigabytes of those .xar files.
    I have a few questions:
    1) Is this the best way to get that info?
    2) If I need to put that command into a variable {$size = (gci w: -r -force ... Length).Sum} to get other info, am I going to kill my poor server's memory?
    Thank you
    [email protected]

    I may need to correlate size across department as sorted by user, or get total number of instances.
    [email protected]
    Is that department / user information all contained in the path to the file, or do you need to do something like query the Owner from NTFS security on the file?
    Here's a quick C# function to search for files and output the full path and size of each to a CSV file.  If this still isn't fast enough, maybe speed can be improved more by using the Win32 API's FindFirstFile / FileNextFile / FindClose functions,
    but I'm not certain how much of a benefit that would give.
    Note:  This code requires at least .NET Framework 4.0, which means PowerShell 3.0.
    Add-Type -TypeDefinition @'
    using System;
    using System.IO;
    using System.Text;
    using System.Collections.Generic;
    public static class FileSearcher
    public static void DumpFileInfoToCsv(string directory, string filter, bool recurse, string csvFile)
    SearchOption searchOption = recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
    if (directory == null)
    throw new ArgumentNullException("directory");
    if (csvFile == null)
    throw new ArgumentNullException("csvFile");
    DirectoryInfo dirInfo = new DirectoryInfo(directory);
    if (!dirInfo.Exists)
    throw new DirectoryNotFoundException(directory);
    using (StreamWriter csv = new StreamWriter(csvFile, false, Encoding.UTF8))
    csv.WriteLine("\"Path\",\"Size\"");
    if (string.IsNullOrEmpty(filter))
    filter = "*";
    foreach (FileInfo fileInfo in dirInfo.EnumerateFiles(filter, searchOption))
    csv.WriteLine("\"{0}\",\"{1}\"", fileInfo.FullName, fileInfo.Length);
    [FileSearcher]::DumpFileInfoToCsv('W:\', '*.xar', $true, "$home\XarFiles.csv")
    You could then examine the CSV file at leisure to group and total up sizes however you like. (Remember to convert the CSV's "Size" column from a string to a numeric type first.)

  • Combining multiple plot data into a single graph.

    This is my current data structure:
    1D array of...  (contains 6 plots, each with their own x and y arrays)
    A cluster of two elements
    1D array of I32
    1D array of DBL
    A cluster of two elements
    2D array of DBL  (y points for multiple plots)
    1D array of I32  (x points for the multiple plots)
    I need to combine these into something suitable for throwing at an XY-Graph.  This operation will need to be done three times (for three different graphs), where only the 2D array of DBL is different for each graph (all three 2D arrays are located in the same cluster along with the shared 1D array).  What is the best way of doing this?
    The 1x6 array of clusters contains plots 0-5 for each graph.  Is there a way to hide these plots from the graph's legend?
    Never say "Oops." Always say "Ah, interesting!"

    J.Mamakos wrote:
    I need to combine these into something suitable for throwing at an XY-Graph.  This operation will need to be done three times (for three different graphs), where only the 2D array of DBL is different for each graph (all three 2D arrays are located in the same cluster along with the shared 1D array).  What is the best way of doing this?
    Sorry - this was actually a bit wrong/incomplete.
    Graph1 includes one 2D array of DBL against the 1D array of I32.
    Graph2 includes elements 2-3 of the 1x6 array, and also one 2D array of DBL against the 1D array of I32.
    Graph3 includes elements 4-5 of the 1x6 array, and also one 2D array of DBL against the 1D array of I32.
    This is how I'm doing it at the moment, but am I missing a trick here?  Is there a better way?
    As for my question about hiding any plots (on the legend) that came from the 1x6 array, is this even posible?
    Either that, or is it possible to hide a graph whilst leaving its legend showing?
    Or can one show/hide a graph's label in run-time?
    Never say "Oops." Always say "Ah, interesting!"

  • I just got a new computer and didn't do Migration Assistant until after I had already created an account. Now I have two users on my computer and want to merge all of the data into one single user. Thanks!

    I am extremely frustrated by this! I have two users now...one with a little bit of new data and the other with all of my important data. I want to be one person!!

    Please do a search, Google or on this forum. This question is asked weekly if not daily and you willl find many threads with all the info needed to fix this problem.
    One place to start is to the right hand side of this page, "More Like This" area >>>>>>>>>>>.

  • Exporting form data to a single table

    I have created a form in LiveCycle Designer ES 8.2  and simply want to export the data into a single table that I can then import into Access. It appears that in LiveCycle the row elements of a table are children of the table element and the column elements are children of the row elements.  I am wondering if there is an easy way to design a form in LiveCycle so that each cell of a table is a root element like the rest of the fields in the form.  I basically want to export one row of data from each form and append it to a larger table. Exporting the data as csv or tab-delimited would be sufficient, but neither of these appears to be an option.

    The only way I've found to do this is to open the form in Acrobat, click Forms, mouse over Manage Form Data, then click Export Data. Your only options are to save as .xml or .xdp. I saved my data as .xml. I was then able to import the .xml file into excel by clicking Data, mousing over xml, clicking Import... and browsing to the Acrobat generated .xml file. I know this is convoluted but it's the only way I've found to get the data into a spreadsheet. Acrobat exports the data as filename_data.xml, i.e. a form named contacts will export it's data as contacts_data.xml. Be aware, I've only tested this on a form that had a table in it and nothing else. If your table is part of a form with other fields in it I have no idea how the other data will look after exporting.

  • Copy and Paste Multiple lines into a single cell

    Folks:
    I need to copy some plain text data into a single cell that has been merged with other cells to provider a larger unit; however, every time I copy and paste my data it gives me an error. In addition, if I paste the data into a single cell, the next line
    of data inserts into the next row.
    I understand that Alt+enter is a quick way to do what I want, but I already have the data typed out, and I do not want to type the data again.
    Example: (If possible I want in one single cell)
    Disks=32
    Total space=1.74TB
    Used space=1.20TB
    Free space=0.54TB
    Thank you!!!

    Is there any way to do this but keep the source formatting? I don't see any "Paste Special" options when you do it this way.
    That is not possible - when you copy/paste this way, you only copy the plain text, not the formatting. You'll have to apply formatting to the cell with pasted lines from scratch.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Append two tables data into one in MSAccess

    Hi All,
    I have huge data which is imported through excel sheet in to MS Access database in 2 separate tables.I want to append the 2nd tables data to the first one...how can i do that...thanks in advance

    hey....i got the solution for this problem....i followed the same procedure of getting external data to MS ACCESS.After migrating all teh 6 sheets data into 6 different tables,I used the same technique to append the data into 1 single table..it worked....Thank you......

  • How to import multiple Excel/CSV columns into a single Sharepoint metadata choice column?

    Consider: I work for an organization that has eight service territories.  We have a series of procedural documents that can apply to from one to eight territories. We are moving this data over to sharepoint, and I'd like to add territory
    data as metadata. Unfortunately, with our current knowledge management system, the best we can get is 8 separate fields flagged as yes/no.
    is1 is2 is3 is4 is5 is6 is7 is8
    1   0  
    1   1   0  
    0   0  
    0
    0   0  
    0   1   1  
    0   0  
    0
    0   0  
    0   0   0  
    0   1  
    0
    I would like to be able to import this data into a SINGLE sharepoint metadata column as Choice/checkboxes/allow Multiple values. Is there a way to do this? We're using Foundations 2010, and our area does not have access to
    development tools (including SPD).

    Thanks for the reply. We have eight individual Columns in the Excel File, and when we do the import to Sharepoint, yes we get eight individual metadata columns.
    I would LIKE to be able to import the eight columns into ONE column in Sharepoint.
    Consider three documents.
    Doc1 is information applicable to Territories 1,3 & 4.
    Doc2 is information applicable to Territories 4 & 5.
    Doc3 is information applicable to Territory 7.
          is1 is2 is3 is4 is5 is6 is7 is8
    doc1   1   0  
    1   1  
    0   0   0  
    0
    doc2   0   0  
    0   1  
    1   0   0  
    0
    doc3   0   0  
    0   0  
    0   0   1  
    0
    This metadata would import to a SINGLE column in SharePoint called IsTerritory, which is defined as a Checkbox (multiple values) Choice Field, limited to the values 1-8.
    Doc1 would have checkboxes 1,3, & 4 checked, Doc2 would have checkboxes 4 & 5 checked, and Doc 3 would only have checkbox 3 checked.
    Does that make a little more sense? I'm having problems validating my account, so I can't upload screenshots yet...
    Thanks in advance for your reply.

Maybe you are looking for

  • BT Infinity Connection Issue (On Going)

    Hi, i've been having problems with my connection over the past 2 weeks and since it seems that none of the people i talk to have any idea what's going on, i thought that i would post my issue on here and see if any one can help. I will try to keep th

  • Cash Journal Limits

    Dear Experts, i m trying to assign Cash limits in Cash Journal Configuration. i have mentioned all details, CoCode, Currency, etc. when i make a trail transaction thru FBCJ, there's no error/ warning pooped. please help.

  • IPhoto quits unexpectedly and does not allow me to update

    When I open iPhoto, I am prompted to upgrade: "The photo library needs to be upgraded to work with this version of iPhoto." Before I even have the opportunity to click Upgrade, the application quits: "The application iPhoto quit unexpectedly." When I

  • Develop Mod. to Print Mod. ?

    Running LR5.7.1. on MacPro - no other programs. The  Photo  image in Develop Mod does not transfer to Print Mod for printing - only the FIRST image in any selected Folder does. Happens with all Folders. Tried earlier LR Cat. same problem. Re-installe

  • HP Pavilion g6 "preparing automatic repair"

    I have an HP pavilion g6, windows 8 laptop. My laptop suddenly froze so I turned it off and turned it back on hoping it would work but instead when I turned it on the "HP" logo comes up and loads for a few minutes and then goes to a bright blue scree