Template:Multiple field result in a single row, comma separated

Hello,
without* having to write a function in Pl/SQL, is it possible, when I have this query,
select     
      "DOSSIER"."ID" as "DOSSIERID",
      "DOSSIER"."TITLE" as "TITLE",
      "DVD"."ID" as "DVDID",
      "DVD"."NAME" as "DVDNAME",
      "DVD"."ID_DOSSIER" as "DVD_ID_DOSSIER",
      "ELEMENTS"."ID" as "ELEMENTSID",
      "ELEMENTS"."NAME" as "ELEMENTSNAME",
      "ELEMENTS"."ID_DVD" as "ELEMENTS_ID_DVD"
from      "DOSSIER" "DOSSIER",
           "DVD" "DVD",
           "ELEMENTS" "ELEMENTS"
where   "DVD"."ID_DOSSIER"="DOSSIER"."ID"
and      "ELEMENTS"."ID_DVD"="DVD"."ID"
  and       "DOSSIER"."TITLE" = 'FIGARO'**Instead of having this result ( with break in the template)*
FIGARO    C2008-203   12l10201.tif
                    12l10202.tif
                    12l11101.tif
                    12l11102.tif
                    12l11201.tif
                    12l11202.tif
                    12l12101.tif
                    12l12102.tif
          C2008-204     12l12202.tif
                    12l13101.tif
                    12l13102.tif
                    12l13201.tif
                    12l13202.tif
                    12l14101.tif
                    12l14102.tif
                    12l14201.tif
                    12l14202.tif
                    12l15101.tif
                    12l15102.tif
                    12l15201.tif
                C2008-205     12l15202.tif
                    12l16101.tif
                    12l16102.tif
                    12l16201.tif
                    12l16202.tif
                    12m01101.tif
                    12m01102.tifhaving this result, WITH the element only, comma separeted??? ( I can have from 0 to 500 elements)
FIGARO
DVD:        C2008-203
Elements:  12l10201.tif, 12l10202.tif, 12l11101.tif, 12l11102.tif, 12l11201.tif, 2l11202.tif, 12l12101.tif, 12l12102.tifthanks, Roseline

This should help you http://tkyte.blogspot.com/2007/03/stringing-them-up.html

Similar Messages

  • Function to concatenate all query results in a single row comma separeted

    Hi All,
    my version is Oracle 10.2.0.4.0
    this is my query:
    select distinct
    table1.id
    from table1,
    table2,
    table3
    where table1.id = table2.id
    and table2.id = table3.id
    and table3.id = '761'
    and result is:
    61
    18
    68B
    S05
    S18
    68
    could someone provide me a function (or something else) in order to have a result like this:
    61,18,68B,S05,S18,68
    and call it from another query?
    I appreciate your help.
    Many thanks.
    Alessandro

    user12889282 wrote:
    could someone provide me a function (or something else) in order to have a result like this:
    61,18,68B,S05,S18,68
    and call it from another query?But this is the wrong way to do it. Better use the original query as a subquery for your second query.
    let me demonstrate it
    select *
    from someotherTable x
    where x.FK_ID IN (select t1.id
              from table1 t1
              table2 t2,
              table3 t3
              where t1.id = t2.id
              and t2.id = t3.id
              and t3.id = 761 /* use numbers not strings for IDs! */
    ;Edited by: Sven W. on Jul 30, 2010 10:17 AM

  • How to Print the same field value in a single row

    Hi,
    I need to print the same field values in a single row
    For Examble
    in a table TestTable
    ID Name Value
    1 AB 120
    1 BC 150
    1 CD 130
    2 AB 111
    2 BC 112
    2 CD 113
    I need the query like if the Name contains BC and CD then i need to print like ID, BC Value, CD Value as below
    ID BC'Value CD'Value
    1 150 130
    2 112 113
    Kindly suggest me...
    Thanks in Advance
    Anu

    Hi,
    Since you're on 9i some available functionality unfortunatly isn't at your disposal.
    This should work, however, using your sample data:
    MHO%xe> create table t as ( -- generating sample data:
      2  select 1 cid, 'AB' cname, 120 cvalue from dual union all
      3  select 1, 'BC', 150 from dual union all
      4  select 1, 'CD', 130 from dual union all
      5  select 2, 'AB', 111 from dual union all
      6  select 2, 'BC', 112 from dual union all
      7  select 2, 'CD', 113 from dual
      8  );
    Tabel is aangemaakt.
    MHO%xe> select cid
      2  ,      max(decode(cname, 'BC', cvalue, null)) BC_value
      3  ,      max(decode(cname, 'CD', cvalue, null)) CD_value
      4  from   t
      5  group by cid;
           CID   BC_VALUE   CD_VALUE
             1        150        130
             2        112        113For reference and future challenges, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:419593546543
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php

  • I need to print one query result as a single row

    Hi,
    I need to print one query result as a single row ,which gives more than one value (of subinventories)and also i would like to print the quantity of that particular subinventory at particular place.Please suggest how can i do this in the report builder?

    Actually I need to print inventory report with subinventory break up.For that all subinventories of category code AB are taken as single row.Based on that subinventory value Quantity must be printed at that particular place.
    For ex
    Quantity
    Item no Description Subinventory Code AB_Abc AB_Def AB_ghi
    1 ***** 12 9
    2 ****** 8 5
    like that.I am waiting for the reply.Plz its some how urgent.
    Thank you,

  • Multiple pages that edit a single row

    I have searched on tabs and editing a single row using multiple pages and I am confused. I don't want to use java as I am trying to not learn that too...
    What I am trying to do sounds like it has been explained before but let me do this again...
    I have a record that is too large to fit on a single screen. This makes for a cumbersome entry process. The record is actually broken into four "logical" chunks. Main, Sub1, Sub2 and Sub3.
    I have made a list that will allow the record to be selected and call the first logical page... L1.
    I have made tabs that show all the pages and allow me to navigate between them quickly.
    When I get to L1 all the data is there. I may not change any data on that page and go directly to L2 through L4. However the record is not brought forward onto those pages. So the pages are not related (and I don't have the terminology right I know :) and I could "link" the pages. So here is what I would like the application to do;
    1. Display a list and allow the user to select the record to edit.
    2. Upon edit go to the first page (tab).. this works
    3. Allow the user to select a tab and the page displays the data for the record selected
    4. Allow the user to complete the edits and save the record. Upon save the user is returned to the list in step 1.
    I was thinking there are several ways to do it... but I was hoping someone could save me a bunch of trial and error (emphasis on the error) ...
    1. When navigating off the page save the record, pass the key and re-read the record... ugly huh?
    2. Pass all the session data for the record over to the next screen. Is that possible? e.g pxx_field1 = pyy_field1
    The the question was does a template with two level tabs keep the record data between tabs?
    Any help is greatly appreciated.
    Sam

    I think this works... kinda
    1. I have a "list" that allows the selection of the item to edit.
    2. That list opens a page that is the "header" page for a tab set.
    3. Each page in the tab set uses the same "ID" to read the record and display the columns. That is how it would work if the list called each individual page.
    4. I modified the "slave" tabs to have the "ID" of the "header" page.
    This displays the correct data on each page. And it looks like the "apply changes" button saves the changes on the page.
    Caveats inlclude (I think as I haven't done exhaustive testing"
    1. "apply changes" must be done at each page where there were changes or they would be lost.
    2. The first dispaly of the page is blank. Clicking on the tab a second time displays the data. This is true if it is the first time a user selects a record in a session (the "slave" tabs are blank) or if it is a subsequent record update (the "slave" tabs have the last records data.
    Thoughts... is this really boring to everyone but me?
    Sam

  • SQ01 results in a single row

    Hi Gurus,
    I have been using the sq01 query to do complex calculations and have been successful in creating tons of queries. What I am stuck with right now is this situation. I created a query and the result is in multiple rows. Here's what it looks like
    Col1      Col2                 Col3             Col4           Col5
    0014       0.00               12.00             0.00           1.00
    0014     20080428           0.00             0.00            0.00
    0014        0.00                0.00             5.00            0.00
    0014        0.00                0.00             0.00            0.00
    Here;s what I want it to look like
    Col1      Col2          Col3       Col4     Col5
    0014     20080428   12.00      5.00     1.00
    Which means i dont want any rows that basically have 0.00 throught and for the key 0014 I want all the data on one single row.
    Is there anyway we can do it using sq01.
    Any suggestions will be appreciated. Thanks in advance
    Kavita
    Edited by: Kavita on Feb 18, 2009 7:44 PM

    Hi,
    Its not possible to have in single row.
    this is same like Education infotype ,all the qualifications will show in different rows.
    You wont get it in single row.
    Bu try to Check Qucikviewer and join conditions...that might helpful to get it...

  • Merging two results into a single row

    Hi, Everyone... I think this is a weighted question and I feel like it's a bit difficult to phrase, so if it doesn't make sense - let me know and I'll try to clarify or provide some more concrete examples (if I can) :)
    I have a few tables inner joined in my sql query - I'd post the entire query here but it's lengthy and will probably add a bit more confusion so let's start with theorizing - where the results sometimes generate more than one row. If more than one row exists, I'd like to take the lowest number in one field and the highest number in another field, and display them on a single row.
    For instance, when I join the PERIOD and SCHEDULE tables, the PERIOD table might provide two rows like the following:
    SCHEDULE_ID      PERIOD_ID      START_TIME    END_TIME
    123               100           32820          35640
    123               101           35940          38760My final result should take the lowest START_TIME and the highest END_TIME, even if they exist is separate rows.
    START_TIME     END_TIME
    32820           38760It doesn't seem easy to me so if someone can make sense of this - you deserve an award. :) If I can provide some more clarification, please let me know. Thanks for any help. Oracle 11g
    Edited by: nage62587 on Sep 27, 2012 11:32 AM

    nage62587 wrote:
    Thanks! I'll try that... I have more than these columns in the result and I'm thinking a Group By likely wouldn't work - I will try but in the event it doesn't, does anyone else have any other suggestions?Group by is the correct way to do this. You group several rows of output into one row. Then you decide which values from inside that group you want to see. This is certainly possible. There are more aggregation functions available than you might think, not only min/max, also min/max + KEEP, count(case expression) and so on.

  • How to display a 1 to many query result in a single row?

    Hi,
    I want to display a 1 to many relationship in a query in just one row. The current result is that I get more than 1 rows. How can I display it in one column with the additional attribute in a column, without repeating? Thank you.
    Select s.student, t.teacher from student_table s, teacher_table t where s.id = t.student_id
    Result
    Student Teacher
    John Doe Larry Woe
    John Doe Mary Moe
    I would rather get a result like this:
    Result
    Student Teacher 1 Teacher 2
    John Doe Larry Woe Mary Woe
    Edited by: Samantha on May 18, 2011 2:48 PM

    Hi,
    Will all Students have exactly two Teachers?
    If not picture your sample with two more Students.
    One having 1 Teacher
    One having N Teachers
    Think about N, what will it be? - How would you create a table with N columns?
    If you can't easily answer above, re-consider what you are trying.
    That said, it could still be done - even if all Students do not have exactly two Teachers - and is called Pivot a dynamic number of columns.
    Examples are in FAQ
    SQL and PL/SQL FAQ
    Still a bad idea, with or without known number of teachers
    Regards
    Peter

  • Outputting Results in a single row from a Table

    Afternoon folks,
    I have a scenario in hand and I was hoping to get some pointers. I could write a PL/SQL program and all would be fine. I was hoping if there was a way to do it in SQL and not have to create a whole new sub-program for this. I already have a PL/SQL program that populates a table. I want to use that data now and output it in a certain manner.
    Any help is greatly appreciated and this is not something I need to solve by tonight. :)
    Script to create table and insert records into it:
    drop table FLIGHT_ROUTES;
      CREATE TABLE FLIGHT_ROUTES
       (FLIGHT_NO           VARCHAR2(7),
        ROUTE_ID            NUMBER,
        DAY_OF_OPERATION    NUMBER,
        ORIGIN              VARCHAR2(3),
        DESTINATION         VARCHAR2(3),
        STOPVER             VARCHAR2(3),
        ROUTE_TYPE          VARCHAR2(1)
    REM INSERTING into FLIGHT_ROUTES
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,1,'SFO','LAX',null,'D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,2,'SFO','LAX',null,'R');  -- Record 2
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,1,'SFO','JFK',null,'D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,2,'SFO','JFK','ORD','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,3,'SFO','JFK','DEN','R');  -- Record 5
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,1,'LAX','JFK','YYZ','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,2,'LAX','JFK','YYC','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,3,'LAX','JFK','YUL','D');What I would like to do is output the results by Flight Number, Origin1, Destination1, Origin2, Destination 2 and Origin 3, Destination 3. The maxium number combinations per Flight is 3. The other condition is that the listing should only show the Origin and Destinations and Stopover if it's a Day time Flight. If its a Red Eye, then don't show that option. So, Record 2 would be completely omitted here as it's a Red Eye flight and Record 5 would be omitted for Origin/Destination/Stopover 3 for flight UX-2001.
    Flight_No       Origin1     Destination1    Stopover 1      Origin2          Destination2      Stopver2      Origin3    Destination3     Stopover3
    ============================================================================================================================================================
    UX-1001         SFO         LAX
    UX-2001         SFO         JFK                             SFO              JFK               ORD
    UX-3001         LAX         JFK             YYZ             LAX              JFK               YYC           LAX        JFK              YULEdited by: Roxyrollers on Sep 9, 2011 3:59 PM
    Edited by: Roxyrollers on Sep 9, 2011 3:59 PM
    Edited by: Roxyrollers on Sep 9, 2011 4:00 PM

    Hi,
    Assuming that day_of_operation is what determines whether a row is 1, 2 or 3:
    WITH     got_r_num     AS
         SELECT     f.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  flight_no
                                   ORDER BY          day_of_operation
                           ) AS r_num
         FROM    flight_routes        f
         WHERE     route_type     != 'R'
    SELECT       flight_no                              || ',' ||
           MAX (CASE WHEN r_num = 1 THEN origin      END)     || ',' ||     -- Origin 1
           MAX (CASE WHEN r_num = 1 THEN destination END)     || ',' ||     -- Destination 1
           MAX (CASE WHEN r_num = 1 THEN stopver     END)     || ',' ||     -- Stopover 1
           MAX (CASE WHEN r_num = 2 THEN origin      END)     || ',' ||     -- Origin 2
           MAX (CASE WHEN r_num = 2 THEN destination END)     || ',' ||     -- Destination 2
           MAX (CASE WHEN r_num = 2 THEN stopver     END)     || ',' ||     -- Stopover 2
           MAX (CASE WHEN r_num = 3 THEN origin      END)     || ',' ||     -- Origin 3
           MAX (CASE WHEN r_num = 3 THEN destination END)     || ',' ||     -- Destination 3
           MAX (CASE WHEN r_num = 3 THEN stopver     END)  AS csv_text            -- Stopover 3
    FROM       got_r_num
    GROUP BY  flight_no
    ORDER BY  flight_no
    ;Output:
    CSV_TEXT
    UX-1001,SFO,LAX,,,,,,,
    UX-2001,SFO,JFK,,SFO,JFK,ORD,,,
    UX-3001,LAX,JFK,YYZ,LAX,JFK,YYC,LAX,JFK,YULThis does not assume that origin1 is always on the same row with day_of_operation=1. Origin1 will be from the row with the lowest day_of_operation, not counting red-eyes. Likewise, origin2 will be from the row with the 2nd lowest day_of_operation, whether that value is 2 or not.
    If your data is such that the row with day_of_operation=n will necessarily be the nth lowest one, not counting red-eyes, then you don't need the sub-query got_r_num; just use your real table (with the condition WHERE route_type != 'R'), and use day_of_operation where I used r_num. (This is what Solomon's solution, which I just saw, does.)
    Edited by: Frank Kulash on Sep 9, 2011 4:47 PM
    Edited by: Frank Kulash on Sep 9, 2011 4:53 PM

  • 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.

  • More than one Input field [Parameter] in a single row on Selection-Screen.

    Hi All,
    I am having one scenario where i need to create 6 input fields on selection screen. 3 input fields in first row and remaining 3 input fields on the second row. So will you guys send me some sample code how to do this.
    Waiting for your reply.
    Regards,
    Santosh

    Hi Santhosh,
    check this snippet for parameters.
    SELECTION-SCREEN SKIP 3.
    SELECTION-SCREEN BEGIN OF BLOCK calc
                        WITH FRAME TITLE text-001 NO INTERVALS.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:
      p_param1(3) type c,
      p_param2(3) type c,
      p_param3(3) type c,
      p_param4(3) type c.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK calc.
    check this snippet for select-options.
    SELECTION-SCREEN SKIP 3.
    SELECTION-SCREEN BEGIN OF BLOCK calc
                        WITH FRAME TITLE text-001 NO INTERVALS.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN :
    PUSHBUTTON 20(3) b1  USER-COMMAND b1,
    PUSHBUTTON  29(3) b4  USER-COMMAND b4,
    PUSHBUTTON  38(3) b7  USER-COMMAND b7,
    PUSHBUTTON  47(3) pm  USER-COMMAND pm.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK calc.
    Hope this would help you.
    Regards
    Narin Nandivada.

  • How to avoid word wrap in the BW Report so that result fits in single row

    Hello Colleagues
    I have a report which shows Material number versus Revenue. In the row, material is displayed with Technical name and description.
    Here, the view of the report shows the description in single line. While, in the report, description of the report runs 3 to 4 lines though description contains 5 to 6 words (which can fit easily into single line).
    Let me know how to restrict each row descrption into single line.
    Regards,
    Ningaraju

    no answers opened new thread to make more clear

  • SQL Multiple Columns Displayed in a Single Row

    Hello everyone,
    I have 2 tables, Product and Product_Name, one Product can have more than one name.
    I need to retrieve it in such a way that I show the Product_ID followed by all the names this product has.
    I'm not able to make it, every way I try I get the Product ID duplicated and several rows with a different product name on each row as follows:
    1, 'Iron Z"
    1, 'Iron M'
    1, 'Iron N'
    2, 'Wood P'
    2, 'Wood M'
    What I need is:
    1, Iron Z, Iron M, Iron N
    2, Wood P, Wood M
    Thanks and Regards.

    Hi,
    user10103934 wrote:
    Thank you for the answer Frank,
    Iron Z, Iron M and Iron N would be 3 different entries on the same column.
    I'm sure the LISTAGG function would resolve this, the problem is that I was hoping to get a solution on pure SQL or PL/SQL, maybe with a nested Select.
    My Oracle version is 10g Express Edition.LISTAGG is pure SQL, but it was only introduced in Oracle 11.2. Everything mentioned below should work in Oracle 10.
    The STRAGG function from that page is very useful. You have to copy and install about 60 line of PL/SQL code. Do that once, and then you can use it hundreds of times in hundreds of queries, just as if it was a built-in function. The main problem with STRAGG is that it's hard to get soprted output from it. There's a modified version, designed for sorted output, on this thread:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15637744429336
    Never used it. Can't vouch for it.
    SYS_CONNECT_BY_PATH seems to be the most popular way of doing string aggregation in Oracle 10. The example given on the Oracle Base page (which I posted in my last message) is a little clumsy and inefficient. See the following thread for a better example, using CONNECT_BY_ISLEAF:
    Re: Concatenate strings from more rows into one row.
    or, now that I see it, Pollywog's example above.
    Edited by: Frank Kulash on Jun 11, 2010 2:24 PM

  • Can I bind multiple field values to a single field?

    Here's the scenario:  I have a form with 2 pages.  On the first page, there are three fields for a person's first, middle, and last name.  On the second page, there's a field that just says "Name".  I want the user to fill out the first, middle and last name fields, and then have the "name" field on the second page reflect all three fields from the first page.  How can I accomplish this?

    Add client-side script to the calculate event on the name field on page 2 to concatenate the name fields on page 1. For JavaScript, something like this:
    this.rawValue = form1.page1.subform1.firstName.rawValue + " " + form1.page1.subform1.lastName.rawValue;
    Steve

  • Returning results as a single-row sub query.

    Hi,
    This is my current query
    WITH car as (SELECT 'FORD' make FROM DUAL UNION SELECT 'TOYOTA' make FROM DUAL UNION SELECT'BMW' make FROM DUAL UNION SELECT 'FIAT' make FROM DUAL)
    SELECT * FROM CARWhich returns:-
    BMW
    FIAT
    FORD
    TOYOTAHowever the actual output required:-
    'BMW, FIAT, FORD, TOYOTA'i.e. all returned on one row.
    Any ideas on how to do this??
    Thanks in advance!
    David

    Hi,
    Or: use row_number() and connect by:
    SQL>  select ltrim(sys_connect_by_path(make,', '),', ') make
      2   from  (
      3         WITH car as (SELECT 'FORD' make FROM DUAL union
      4                       SELECT 'TOYOTA' make FROM DUAL UNION
      5                       SELECT'BMW' make FROM DUAL UNION
      6                       SELECT 'FIAT' make FROM DUAL
      7                      )
      8         SELECT make
      9         ,      row_number() over (order by make) rn
    10         FROM CAR
    11         )
    12    where connect_by_isleaf = 1
    13   connect by rn = prior rn + 1
    14   start with rn = 1
    15   order by make
    16  ;
    MAKE
    BMW, FIAT, FORD, TOYOTA
    1 row selected.Edited by: hoek on Jun 5, 2009 12:56 PM
    But how could I even think I'd type faster than Lightnin' Blushadow? ;)

Maybe you are looking for