Data in multiple lines concatenated into a single line to separate id

Hello

I have a t1 like this table:

create table t1
(number of c1,
number of C2,
C3 number (4.2)
);

Data in the table are such as:

----------------------------------------
C1 | C2 | C3 |
-----------------------------------------
102. 1. 1.1 |
102. 1. 1.2 |
102. 2. 2.1 |
103. 2. 2.1 |
103. 2. 2.2 |
-----------------------------------------

How to display data by using a query above?

------------------------------------------------------
C1 | C2 | C3 |
-------------------------------------------------------
102. 1, 2 | 1.1, 1.2, 2.1 |
103. 2. 2.1, 2.2.
------------------------------------------------------

Thank you

So you're after what we call 'Aggregation in the chain.'

Check this link as it highlights several techniques:

Aggregation of string techniques

A Re: Concat ranks of the values in a single column Michael

At Re: multiple lines in a single line in the 'single column Table' followed by reason of Billy on the conduct of a stragg first.

In addition, 11 GR 2 has the LISTAGG function.

Tags: Database

Similar Questions

  • Create views of data from multiple lines in a single column shows

    Hi all - it's probably posted in the wrong forum, but I couldn't find that was right.

    I'm almost a perfect beginner in sql, but I have a need to create a view that can be expanded to 10g (which effectively runs the volumes are likely to be high) who will do the following.

    Authentic table with columns Parent_code, Child_code
    Parent_Code Child_Code
    1000-2000
    1000-3000
    1000-4000
    2000 3000
    2000-5000

    (note that Parents may have several children and a child can have multiple parents!)

    What I have to finish with in my opinion is the following

    Child_Code Parent_List
    ' 2000 ' 1000 (3).
    3000 "1000 (3), 2000 (2)"
    ' 4000 ' 1000 (3).
    "5000 ' 2000 (2)"

    Note the number in parentheses is the number of children whose parent's - IE in the original parent a 1000, 3 table lines (one for each child)

    This point of view should be used as a quick glance upward (on the children's code) for a report of business objects.

    Is there someone who could you PLEASE, PLEASE help me quickly on what I have very little time to find a solution?

    Hello

    You can test these:

    select child_code
         , ltrim(sys_connect_by_path(parent_info,', '), ', ') as parent_list
    from (
      select child_code
           , to_char(parent_code) ||
             ' (' ||
             count(*) over(partition by parent_code) ||
             ')' as parent_info
           , row_number() over(partition by child_code order by parent_code) rn
      from your_table
    )
    where connect_by_isleaf = 1
    connect by prior rn = rn-1
           and prior child_code = child_code
    start with rn = 1
    ;
    
    select child_code,
           rtrim(
             extract(
               xmlagg(xmlelement("e",parent_info||', ') order by parent_info)
             , '//text()'
             )
           , ', '
           ) as parent_list
    from (
      select child_code,
             to_char(parent_code) ||
             ' (' ||
             count(*) over(partition by parent_code) ||
             ')' as parent_info
      from your_table
    )
    group by child_code
    ;
    

    What you need is called 'chain aggregation '.
    See here for the various techniques, including the two above: http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

  • Can not put multiple PDF files into a single document no more.

    I was able to scan multiple PDFs into one document on my desktop. I can no longer. I have a printer Photosmart HP 6515 and Windows7 OS.  PS. just the other day I had someone remotely access my computer to fix a problem with MagicJack (computer phone) and who knows what they might have done. Thank you to everyone.

    Nice day

    Here are a few screenshots I took it to give you an example of how to do to scan several pages in the scanner software. Make sure that the option is disabled for the creation of a separate file for each scanned page. Subsequently, click on the 'Destination' tab above and save it to any folder you want on your desktop or elsewhere.

    This should help, good luck

    Have a great weekend!

  • data in multiple lines

    Hello

    I use 10g. My table table1 has given it's like
    col1 col2
    a 1
    b, c 2
    , a, e, t 3

    Now I would like to get separate of col1 values because I need to use it in the Group of
    I need to use i.e. number group by col1.

    We hear the result must be

    a-> 2
    b > 1
    c > 1 like this.

    Now the col1 being separated by commas I thought that break into several columns.

    as
    a 1
    b 2
    c 2
    a 3
    e 3
    t 3

    I just want to know how shoul I stat it?

    Thank you

    ITC resembles col2 stores the number of elements separated by commas in col1. If so:

    with t as (
               select ',a' col1,1 col2 from dual union all
               select ',b,c',2 from dual union all
               select ',a,e,t',3 from dual
              )
    -- end of on-the-fly data sample
    select  regexp_substr(col1,',[^,]+',1,column_value) col1,
            col2
      from  t,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= col2
                               )
                       as sys.OdciNumberList
                      )
                 )
    /
    
    COL1         COL2
    ------ ----------
    ,a              1
    ,b              2
    ,c              2
    ,a              3
    ,e              3
    ,t              3
    
    6 rows selected.
    
    SQL> 
    

    Otherwise:

    with t as (
               select ',a' col1,1 col2 from dual union all
               select ',b,c',2 from dual union all
               select ',a,e,t',3 from dual
              )
    -- end of on-the-fly data sample
    select  regexp_substr(col1,',[^,]+',1,column_value) col1,
            col2
      from  t,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= length(regexp_replace(col1,'[^,]'))
                               )
                       as sys.OdciNumberList
                      )
                 )
    /
    
    COL1         COL2
    ------ ----------
    ,a              1
    ,b              2
    ,c              2
    ,a              3
    ,e              3
    ,t              3
    
    6 rows selected.
    
    SQL> 
    

    SY.

  • Save a pdf file showing multiple work plans into a SINGLE pdf PAGE

    Hello

    How can I save my pdf so my 4 work plans presents a single PDF PAGE? (I don't want to merge 4 rebounds in a single pdf FILE, but I want to be able to see all the work plans of the 4 side by side in a single file pdf.)

    Can I choose when opening the pdf file, or what I need to record a special way in Illustrator, to have my 4 work plans?

    Cordially Grimkarklud

    What you want to do is to convert your work plans by plowing the pages. I tried with CS4 (saving up to CS), and the main problem I've had is having to close the gap that has been previously between work plans.

    Help Adobe seems to imply that the CS5 works better

    If you save a document Illustrator of multiple-work plan in a previous version of Illustrator, such as CS3, you can choose to save each work plan in a separate file, as well as a master file that includes all the merged work plans. »

    If you try CS5 save up to CS3.

    Once you get pages of tiles, then when you make a PDF file, all your pages will be on a single page pdf.

  • Combine multiple files into a single file adobe adobe - do I need to buy additional products other than the adobe reader software

    I don't seem to be able to combine multiple adobe files into a single adobe document.  Do I need to buy an additional product for this in adobe reader?

    Hi Art Brock,

    You can buy the Adobe PDF package to combine the files using Adobe Reader, if you must use Acrobat Reader DC for this task.

    You can purchase the subscription by using the following link: online PDF converter, convert to web or Acrobat Reader | Adobe PDF Pack

    Kind regards
    Rahul

  • IDCS6 MACOSX JS: data merge multiple txt files one after the other

    Hello everyone.

    I have a situation where I have to data merge multiple text files to a single file indesign real "base". Databases formats are the same, the point of difference is a code in the second field of the database that refers to a postal box (not a zip/postal code, a code of 'distribution center' that has possibilities of 56 or greater). I would prefer data merge a file and then somehow split the PDF via Acrobat, but the length of postal areas resulting is incompatible and something that cannot be done if the document "split" feature in acrobat.

    The database starts as one massive file but using a one line code, can be divided into postal areas in separate text files.

    My last question: is it possible data merge several files at the same time (for example one after the other) and to give them their names based on the names of the input text file?

    OLE Kvern had a script to merge the data to a file without the user interface. I changed the last line slightly so that it generates a PDF file based on [high quality]:

    if(app.documents.length != 0){
            var myDocument = app.activeDocument;
            app.dataMergeOptions.removeBlankLines = true;
            //Select a source file.
            var myDataFile = File.openDialog("Select a data file")
            var exported = "file location(redacted for the sake of this post)"
            if(myDataFile != ""){
                    myDocument.dataMergeProperties.selectDataSource(myDataFile,);
                    myDocument.dataMergeProperties.exportFile(exported,"[High Quality Print]",);
            }
    
    }
    

    I guess that the answer has to do with the variable "myDataFile" and rather than just being open a dialog box, it could be somehow by selecting a table of text files, but it is where I am out of my depth.

    Ideas or thoughts which may not involve trying to do both the many mergers, but can somehow revolve around a great fusion of PDF?

    Thank you very much

    Colin

    Since writing my last response, I realized there was a better answer. It is a scenario of Peter Kahrel and a modified version of a script by Olav Kvern. Details can be found here: batch of merge data | Adobe Community

    I have since made other mods to the script is easier to understand:

    if(app.documents.length != 0){
    // make sure to use the document that is open
            var myDoc = app.activeDocument;
    // get the name of the document that is open for future naming purposes
            var myName = myDoc.name
    // get the location of the folder that contains both the indesign files and the text files
            var myLocation = "FULL PATH LOCATION OF FOLDER CONTAINING TEXT FILE AND DESTINATION FOR FINAL PDFS"
    // define the names of the data files to use based upon the names of the indesign files
            var myImport = myLocation + myName + ".txt"
    // define the names of the data merged PDFs to be created
            var myExport = myLocation + myName + ".pdf"
    // the actual engine for the merge, including DM instructions such as remove blank lines, object fitting etc.
            var myDataFile = myImport
            app.dataMergeOptions.removeBlankLines = true;
            if(myDataFile != ""){
                    myDoc.dataMergeProperties.selectDataSource(myDataFile,);
                    myDoc.dataMergeProperties.exportFile(myExport, "[PDF/X-1a:2001]", );
            }
    
    }
    

    If this script will automatically merge a file which is open as LONG as the data file is the same name as the indesign file with .txt at the end for example

    Woodward.indd (indesign file)

    Woodward.indd.txt (used for merging text file)

    This script does still not the original memory and who was using an indesign document, to browse for many text files and merging of PDF based on text files.

    HOWEVER, I am sure that the answer to that is based only on the use of the script above (no need to Peter batch convert script) and changing the line 9 to be a loop for... but again, this is where I come to a grinding halt. Any help would be appreciated.

    Colin

  • Simple question: how to divide the string into multiple lines concatenated?

    Hi people,

    Maybe it's an easy question.

    How to split a string that is concatenated into multiple lines by using the SQL query?

    ENTRY:
    select 'AAA,BBB,CC,DDDD' as data from dual
    Delimiter = ', '.

    Expected results:
    data
    ------------
    AAA
    BBB
    CCC
    DDDD
    I'm looking for something nice to feature "an opposite to «sys_connect_by_path»»

    Thank you
    Tomas
    with t as (select 'aaaa,,bbbb,cccc,dddd,eeee,ffff' as txt from dual)
    -- end of sample data
    select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
    from t
    connect by level <= length(regexp_replace(txt,'[^,]*'))+1
    
    REGEXP_SUBSTR(TXT,'[^,]+',1,LE
    ------------------------------
    aaaa
    bbbb
    cccc
    dddd
    eeee
    ffff
    
  • Data from multiple rows in single line in BI publisher 11g

    Hello

    I receive documents in multiple lines

    for example

    ID case1, case3 CAS2

    1 C1

    1 C1

    1                 C2

    1                              C4

    Now, I want to make it as a single line, output desired is

    ID Case1, Case3 CAS2

    1 C1 C2 C4

    is it possible, please let me know.

    Thanks in advance

    Kind regards

    Sam

    He seems to do at the level of the model.

    Could you please post your example of xml data?

  • Convert a single column into multiple lines

    Hi people,

    I have a task to display a single column into multiple lines (for use in LOV)

    For Ex:

    The column consistes of value such as 98,78,67,68,34,90. -It's a unique column values where none of the values can be ' number that is separated by commas

    Then we must view it as

    98
    78
    67
    68
    34
    90
    -under the number of lines (no lines can be ' do not number).

    Thanks in advance

    Try this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  select regexp_substr('98,78,67,68,34,90', '[^,]+',1,level) Value
      2    from dual
      3*   connect by level <= regexp_count('98,78,67,68,34,90',',') + 1
    SQL> /
    
    VALUE
    -----------------
    98
    78
    67
    68
    34
    90
    
    6 rows selected.
    

    Thank you!

  • How to insert multiple lines using a single query

    Hi all

    How to insert multiple lines using a single query to the emp table?
    I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.


    Thank you
    Sunil

    Like this?

    SQL> create table test(id number , dt date);
    
    Table created.
    
    SQL> insert into test values(&a,&b);
    Enter value for a: 1   --- It asked me and I entered 1
    Enter value for b: sysdate  --- It asked me and I entered sysdate
    old   1: insert into test values(&a,&b)
    new   1: insert into test values(1,sysdate)
    
    1 row created.
    
    SQL> 
    

    g.

  • Paste multiple lines of text in a single cell in a table

    Hi all

    I lost it by train for formatting columns and thought it would be easier to put the data in a table.

    I tried selecting my 5 lines (name and address) and paste it into a single cell of a table, but it keeps splitting up to more than 5 cells.  Is any way to replace it?

    Thank you

    Hey Shorty,

    Select the 5 lines of text and copy (or cut).

    In a table cell, click twice to place the cursor in the cell (the cursor is now in the text layer of the cell).

    Dough.

    Kind regards

    Ian.

  • Combine multiple lines into one line (from two tables / result sets)

    Hello experts,

    I would like to know how to combine multiple lines/records in a single record. Here are the DDL and DML to tables:

    create table test_table)

    client_name varchar2 (50 char),

    login_time timestamp (6).

    logout_time timestamp (6).

    auto_type varchar2 (10 char)

    )

    create table root_table)

    navigation_time timestamp (6).

    client_name varchar2 (50 char),

    VARCHAR2 (50 char) nom_du_groupe

    )

    Insert into test_table

    values ("John", TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');

    Insert into test_table

    values ('David', TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');

    insert into root_table

    values (TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "invalid");

    insert into root_table

    values (TO_TIMESTAMP ('2013-12-05 17:14:22.333 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");

    insert into root_table

    values (TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");

    insert into root_table

    values (TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), "David", "invalid");

    insert into root_table

    values (TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'David', 'GROUP_5');

    game results test_table

    client_name

    login_time logout_time auto_typeJohn05/12/2013 5:04:01.512000 PM05/12/2013 5:27:31.308000 PMSIMPLEDavid05/12/2013 6:33:01.308000 AM05/12/2013 6:45:01.112000 AMSIMPLE

    root_table result set

    navigation_time client_name GroupName
    05/12/2013 5:04:01.512000 PMJohnNot valid
    05/12/2013 5:14:22.333000 PMJohnGROUP_1
    05/12/2013 5:27:31.308000 PMJohnGROUP_1
    05/12/2013 6:33:01.308000 AMDavidNot valid
    05/12/2013 6:45:01.112000 AMDavidGROUP_5

    And here is the SQL code I'm writing:

    Select a.customer_name, a.login_time, a.logout_time, a.auto_type, Max (b.group_name)

    from test_table a, b root_table

    where a.customer_name = b.customer_name

    Group of a.customer_name, a.login_time, a.logout_time, a.auto_type

    As the 'invalid' value is greater than the value "GROUP_1" (based on the number of letter in English), the GroupName is returned as 'invalid '. I want to bring the GroupName based on the navigation_time column in the root_table so that it always returns a valid GroupName. Please help me.

    Output current:

    Client_name.      Login_Time.     Logout_Time |     Auto_Type |     GroupName

    --------------------------------------------------------------------------------------------------------------------------------------------

    John |     05/12/2013 5:04:01.512000 PM |     05/12/2013 5:27:31.308000 PM |     SIMPLE |     Not valid

    David |     05/12/2013 6:33:01.308000 AM |     05/12/2013 6:45:01.112000 AM |     SIMPLE |     Not valid

    Expected results:

    Client_name.      Login_Time.     Logout_Time |     Auto_Type |     GroupName

    --------------------------------------------------------------------------------------------------------------------------------------------

    John |     05/12/2013 5:04:01.512000 PM |     05/12/2013 5:27:31.308000 PM |     SIMPLE |     GROUP_1

    David |     05/12/2013 6:33:01.308000 AM |     05/12/2013 6:45:01.112000 AM |     SIMPLE |     GROUP_5

    Thank you!

    Adding INSERT statements, current and planned outputs.

    This...

    SELECT client_name

    login_time,

    logout_time,

    auto_type,

    GroupName

    Of

    (select a.customer_name,

    a.login_time,

    a.logout_time,

    a.auto_type,

    b.group_name,

    ROW_NUMBER() over (PARTITION BY a.customer_name, a.login_time, a.logout_time, a.auto_type ORDER BY b.group_name) rn

    from test_table a, b root_table

    where a.customer_name = b.customer_name)

    WHERE rn = 1;

    OUTPUT:-

    =========

    David DECEMBER 5, 13 06.33.01.308000000 AM DECEMBER 5, 13 06.45.01.112000000 AM SIMPLE GROUP_5
    John DECEMBER 5, 13 05.04.01.512000000 PM DECEMBER 5, 13 05.27.31.308000000 PM SIMPLE GROUP_1

    Thank you

    Ann

  • Convert multiple lines in a single value separated by commas

    Is is possible to convert multiple lines in a single value by concatenating the value of each line in OBIEE. I think that IO had seem a blog related to this by I'm not able to find him. Essentially, here's what I would do:
    Number of customer location
    101
    101 NY
    101 PA
    102 TX
    102 CA

    This is to convert
    101. HE, NY, PA
    102 TX, CA

    Can you get it someone please let me know if this is possible and how to operate it.

    Thanks in advance for the help.

    You can do this by creating a DB function,

    Visit this link
    Re: Display of the horizontal values

    Thank you
    Vino

  • SELECT SQL to merge the text of different lines into a single line

    Hello

    I need to create a Select statement to merge multiple lines in a single text. I have a table with the following data:
    SQL> DESC doc_comments
     Name                                                  Null?    Type
     ----------------------------------------------------- -------- ------------------------------------
     DOC                                                            NUMBER
     COMMENTS                                                       VARCHAR2(30)
    
    SQL> SELECT * FROM doc_comments
      2  /
    
           DOC COMMENTS
    ---------- ----------
             1 Note A
             1 Note B
             2 Note C
             2 Note D
             2 Note E
             3 Note F
    
    6 rows selected.
    I need to create a query on the table to show a result like this:
    DOC          COMMENTS
    ------------ --------------------------
               1 Note A, Note B
               2 Note C, Note D, Note E
               3 Note F
    A possible solution would be to create a function to merge the text of the various lines and then use it in the query, but I'm not allowed to create any function in the database, I can use a simple SELECT statement.

    Any ideas on how I can do?

    Assuming that comments contain no vertical bar (|) character:

    with doc_comments as (
                          select 1 doc,'Note A' comments from dual union all
                          select 1,'Note B' from dual union all
                          select 2,'Note C' from dual union all
                          select 2,'Note D' from dual union all
                          select 2,'Note E' from dual union all
                          select 3,'Note F' from dual
                         )
    select  doc,
            replace(ltrim(sys_connect_by_path(comments,'|'),'|'),'|',', ') comments
      from  (
             select  doc,
                     comments,
                     row_number() over(partition by doc order by comments) rn
               from  doc_comments
            )
      where connect_by_isleaf = 1
      start with rn = 1
      connect by doc = prior doc
             and rn  = prior rn + 1
      order by doc
    /
    
           DOC COMMENTS
    ---------- ----------------------------------------
             1 Note A, Note B
             2 Note C, Note D, Note E
             3 Note F
    
    SQL> 
    

    And if the comments may contain the vertical bar (|), then replace the hose in the code above with a character that is not used in the comments.

    SY.

Maybe you are looking for

  • How to reinstall in recovery mode?

    Hello... I got elcapitan and 10 installed but windows to free up disk space (too many music files) I deleted the content of the macosx with disk management in windows... now I have no use for music files... .and I opened with pressing alt it is recov

  • Error code 2, while he was trying to install the SP1 for Windows 7

    I downloaded and I try to install the update of security Microsoft .NET Framework 1.1 Service Pack 1 for Windows 2000, Windows XP, Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2 (KB953297) I get an error message 'Code 2' whe

  • My computer has been infected by a virus, which I have never handled before.

    Exactly what the title says. Recently, my computer has been infected by a virus. I ran a quick scan, and then a full scan of my computer and removed 18 Trojan horses. I open MSCONFIG and put it on Normal startup, I pressed F8 to get out of Safe Mode,

  • Data exported to FDMEE but zero KB file generated planning to get

    Hi all, I tried to export data from FDMEE to planning. I managed to all stages of FDMEE and I get all the fish also. But when I check the Outbox folder, I get a zero KB file. Its not having only not all data to hit the cube. Please notify. Loading da

  • I want to cancel my membership

    My subscription is a plan of creative photography of cloud, student and Teacher Edition (one year) and I want to cancel it due to lack of funds.