Combine multiple rows in single row

I am new to SQL server and i am trying to combine multiple row in single row but i am not able to do it.Can anyone help me out?
Input :
Id |RED |BUY |BSW
1328 NULL NULL 0.05
1328 NULL 0.06 NULL
1328 0.01 NULL NULL
1328 0.05 NULL NULL
1329 NULL NULL 0.05
1329 NULL 0.05 NULL
1329 0.05 NULL NULL
Output
Id |RED |BUY |BSW
1328 0.01 0.06 0.05
1328 0.05 NULL NULL
1329 0.05 0.05 0.05

Actually I am consolidating above result into text file and sending it to external system.Main aim is to remove NULL values and arrange the data as expected output.
Also expected output can be
Id         |RED   
|BUY    |BSW
1328        0.05   
0.06    0.05
1328        0.01   
NULL    NULL
Or
Id         |RED   
|BUY    |BSW
1328        0.01   
0.06    0.05
1328        0.05   
NULL    NULL
for Id= 1328.

Similar Messages

  • Combining multiple rows to singe row thru SQL Stmt

    Hello,
    I am trying to combine values returned from multiple row into one row,
    thru inner/outer sql or any optimal way.
    In the example i would like to have First name, Last name, email and phone to be
    returned as a single row.
    create table TEMP_AAAAA
      FIRST_NAME VARCHAR2(25),
      LAST_NAME  VARCHAR2(25),
      CON_METHOD VARCHAR2(25),
      CON_VALUE  VARCHAR2(25)
    INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','EMAIL','[email protected]');
    INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','PHONE','12345');Any suggestion in doing it thru sql stmt.
    I have done this thru pl/sql, wondering if this could be achieve thru single SQL Stmt
    DECLARE
    v_FIRST_NAME  VARCHAR2(25);
    v_SECOND_NAME VARCHAR2(25);
    v_EMAIL       VARCHAR2(25);
    v_PHONE       VARCHAR2(25);
    BEGIN
    v_FIRST_NAME := NULL;
    v_SECOND_NAME := NULL;
    v_EMAIL := NULL;
    v_PHONE := NULL;
    FOR IMPL_CUR IN(SELECT * FROM TEMP_AAAAA ORDER BY CON_METHOD DESC)
    LOOP
            IF v_FIRST_NAME IS NULL
            THEN
               v_FIRST_NAME := IMPL_CUR.FIRST_NAME;
            END IF;
            IF v_SECOND_NAME IS NULL
            THEN
               v_SECOND_NAME := IMPL_CUR.LAST_NAME;
            END IF;  
            IF v_PHONE IS NULL AND IMPL_CUR.CON_METHOD = 'PHONE'
            THEN
               v_PHONE := IMPL_CUR.CON_VALUE;
            END IF;
            IF v_FIRST_NAME = IMPL_CUR.FIRST_NAME AND
               v_SECOND_NAME = IMPL_CUR.LAST_NAME AND
               length(v_PHONE) > 0
            THEN
              IF v_EMAIL IS NULL AND IMPL_CUR.CON_METHOD = 'EMAIL'
              THEN
                 v_EMAIL := IMPL_CUR.CON_VALUE;
                 EXIT;
              END IF;       
            END IF;
    END LOOP;
             DBMS_OUTPUT.put_line('firstName...:' || v_FIRST_NAME);    
             DBMS_OUTPUT.put_line('lastName....:' || v_SECOND_NAME);    
             DBMS_OUTPUT.put_line('PHONE.......:' || v_PHONE);
             DBMS_OUTPUT.put_line('EMAIL.......:' || v_EMAIL);
    END;

    Hi Ludy,
    Following query should work -
    P.S. - I have added records for one more person with first name as 'TOM1' and last name as 'MAC1' for testing purpose. Given inserts for these 2 records as well.
    Connected to Oracle Database 11g Release 11.2.0.1.0
    SQL>
    SQL> INSERT INTO TEMP_AAAAA VALUES('TOM1','MAC1','EMAIL','[email protected]');
    1 row inserted
    SQL> INSERT INTO TEMP_AAAAA VALUES('TOM1','MAC1','PHONE','12345');
    1 row inserted
    SQL>
    SQL>
    SQL> SELECT t.first_name
      2        ,t.last_name
      3        ,MAX(decode(t.con_method, 'PHONE', t.con_value, NULL)) phone
      4        ,MAX(decode(t.con_method, 'EMAIL', t.con_value, NULL)) email
      5    FROM temp_aaaaa t
      6   GROUP BY t.first_name
      7           ,t.last_name
      8  /
    FIRST_NAME     LAST_NAME   PHONE   EMAIL
    TOM            MAC         12345   [email protected]
    TOM1           MAC1        12345   [email protected]
    SQL> Hope this helps.
    Cheers,
    - Anirudha
    Edited by: Anirudha Dhopate on Nov 10, 2011 9:12 PM

  • To Combine Multiple STOu2019s into Single Delivery

    Hi,
    What are the configuration settings to be done to combine multiple STOu2019s into one single delivery in VL10B. 
    My requirement is to combine multiple STOu2019s contains different DELIVERY DATES and having SAME SUPPLYING AND RECEIVING PLANT into one single delivery.
    Thanks & Regards,
    Victor.

    Hi
    Delivery in STO is created for single order and for same delivery date, same delivery no. for different delivery date and  for multiple STO is not possible and its not logically correct,since after creation of delivery you will be doing picking and packing and Goods Issue.
    Please check
    Kishor

  • Combining Multiple Rows into single row with multple columns

    Hi Experts,
    I have the following requirement, kindly help me.
    I have data in my table like below.
    ID NAME DEPT
    1 Sam 10
    1 Sam 20
    2 alex     30
    2 alex 40
    2 alex 50
    3 vinod 60
    3 vinod 70
    I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.
    ID NAME DEPT1 DEPT2 DEPT3
    1 Sam 10 20
    2 alex 30 40 50
    3 vinod 60 70
    It's urgent requirement, kindly help me.
    Thanks in advance.

    Right I've had my drink, so what was this "urgent" question then?
    798616 wrote:
    I have data in my table like below.
    ID NAME DEPT
    1 Sam 10
    1 Sam 20
    2 alex     30
    2 alex 40
    2 alex 50
    3 vinod 60
    3 vinod 70
    I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.Dynamic numbers of columns eh! Tricky.
    If you understand how SQL statements are executed it's along these lines...
    1. Open Cursor
    2. Parse SQL statement and determine columns
    3. Bind in any input values
    4. Fetch data
    5. Bind out values to columns
    6. Repeat step 3 until no more data
    7. Close cursor
    Now, you're expecting that you can determine the columns (step 2) from the fetched data (step 4 onwards). You can't. The SQL engine needs to know the expected columns before any data is fetched so, it can't base the number of columns on the data itself.
    If you need that requirement, you would need to query the data first and build up a dynamic query based on the data and then execute that dynamically built query to fetch the data and pivot it into those columns, which means that you have queried the data twice. Not good practice and not good (or simple) coding.
    What you're talking of doing is something that should be handled at the presentation/interface layer, not as part of the data fetch.
    Typically these sorts of things are handled most easily in report generation/writer tools such as Oracle Reports, Business Objects etc. where they fetch the data from the database and then process it to format it on the display, pivoting the results as required.
    It's not something that lends itself to be easily achieved in SQL. Yes, SQL can do pivoting of data quite easily, but NOT with a dynamic number of columns.
    If you were to specify that there is a maximum number of columns that you could get (rather than wanting it dynamic), then you can do it simply in SQL with the max-decode method...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select deptno, ename, row_number() over (partition by deptno order by ename) as rn from emp)
      2  --
      3  select deptno
      4        ,max(decode(rn,1,ename)) as ename1
      5        ,max(decode(rn,2,ename)) as ename2
      6        ,max(decode(rn,3,ename)) as ename3
      7        ,max(decode(rn,4,ename)) as ename4
      8        ,max(decode(rn,5,ename)) as ename5
      9        ,max(decode(rn,6,ename)) as ename6
    10        ,max(decode(rn,7,ename)) as ename7
    11        ,max(decode(rn,8,ename)) as ename8
    12        ,max(decode(rn,9,ename)) as ename9
    13        ,max(decode(rn,10,ename)) as ename10
    14  from t
    15  group by deptno
    16* order by deptno
    SQL> /
        DEPTNO ENAME1     ENAME2     ENAME3     ENAME4     ENAME5     ENAME6     ENAME7     ENAME8     ENAME9     ENAME10
            10 CLARK      KING       MILLER
            20 ADAMS      FORD       JONES      SCOTT      SMITH
            30 ALLEN      BLAKE      JAMES      MARTIN     TURNER     WARD
    SQL>

  • Combining multiple rows into a single row

    Hi all,
    I have a tricky situation in a HR select.
    Imagine I have a dataset as below, simplified of course.
    Name Start Date End date Job Title Salary
    Tom 01/01/07 02/03/08 Gopher £500
    Tom 03/03/08 jobsworth £600
    Rick 04/05/09 Painter £500
    Harry 02/06/07 02/06/08 Gardener £300
    Harry 03/06/08 03/06/09 Runner £200
    Harry 04/06/09 Cook £400
    now, I need to select from above and return 3 rows so it looks as below
    name start date enddate title salary start date enddate title salary start date enddate title salary etc etc
    tom 01/01/07 02/03/08 gopher £500 03/03/08 blah 600
    Rick 04/05/09 painter £500
    harry etc etc etc
    Now, I know how to select onto one row ok, asumming that each employee has a fixed number of roles but the problem is that each employee has a different number of jobs, one could have had 5 while another 50 and I do not know the maximum at this time.
    Anyone have any ideas on how to appraoch this?
    tia,
    dw
    Edited by: derrywriter on Oct 2, 2009 3:50 PM
    Edited by: derrywriter on Oct 2, 2009 3:54 PM

    Ideally this should be done in a suitable reporting tool.
    Standard SQL requires a deterministic number of columns to be known at parse time i.e. before the data is fetched it needs to know how many columns are being returned.
    If you know there is a fixed maximum to the number of columns that can be returned you can use one of the various pivot methods (search the forum) which differ depending on whether you're using 9i, 10g or 11g database.
    If you can't determine a maximum number of columns you're pretty much stuck, unless you want to write some clever interfacing to the oracle ODCI as demonstrated in this thread:
    How to pipeline a function with a dynamic number of columns?
    Personally, I believe such reporting styles should be reserved for reporting tools.

  • Combine multiple rows of table in single row

    Hi Experts,
    I have a table of below format.
    MSDNID
    WALL_BAL
    WALL_DATE
    123
    34
    06-Sep-13
    123
    56
    07-Sep-13
    123
    78
    08-Sep-13
    123
    65
    09-Sep-13
    123
    34
    10-Sep-13
    123
    87
    11-Sep-13
    Now I have to create a new table. which should contain unique MSDNID with WALL_BAL in different column .
    Like below
    MSDNID
    DAY1_BAL
    DAY2_BAL
    DAY3_BAL
    DAY4_BAL
    DAY5_BAL
    DAY6_BAL
    123
    87
    34
    65
    78
    56
    34
    How can I write a query for this?

    in 10g , you can use something like
    select MSDNID,
    max(decode(WALL_DATE, '11-Sep-13', WALL_BAL, null) day_1_bal,
    max(decode(WALL_DATE, '06-Sep-13', WALL_BAL, null) day_6_bal
    from t
    group by MSDNID;
    But it only works if you have limited # of days.

  • HOW TO COMBINE MULTIPLE ROWS INTO SINGLE ROWS

    Hi,
    I have a table with the following data:
    CASE-1
    TABLE -X
    RNO      FROM_SQN     TO_SQN     DATE
    ==========================================
    991      9           11     2010-01-01
    991      11           22     2010-01-01
    991      22           33     2010-01-01
    992      33           44     2010-01-01
    I want to see the result data as follows:
    RNO      FROM_SQN     TO_SQN     DATE
    ==========================================
    991      9           44     2010-01-01
    CASE-2
    TABLE -X
    RNO      FROM_SQN     TO_SQN     DATE
    ==========================================
    991      9           11     2010-01-01
    991      15           22     2010-01-01
    991      22           34     2010-01-01
    992      33           44     2010-01-01
    I want to see the result data as follows:
    RNO      FROM_SQN     TO_SQN     DATE
    ==========================================
    991      9           11     2010-01-01
    991      15           44     2010-01-01
    Please help me how to achieve this using SQL.
    Edited by: 986725 on Feb 7, 2013 2:36 AM

    with x as
    select 991 rno, 9 from_sqn ,11 to_sqn ,to_date('2010-01-01','yyyy-mm-dd') dt
    from dual union all
    select 991, 15 ,22 ,to_date('2010-01-01','yyyy-mm-dd') from dual union all
    select 991, 22 ,33 ,to_date('2010-01-01','yyyy-mm-dd') from dual union all
    select 991, 33 ,44 ,to_date('2010-01-01','yyyy-mm-dd') from dual
    x_with_group as
    select rno,from_sqn,to_sqn,dt,
           sum(sm) over(partition by rno,dt order by from_sqn) sm
    from
      select rno,from_sqn,to_sqn,dt,
             from_sqn-
              nvl(lag(to_sqn) over(partition by rno,dt order by from_sqn),0) sm
      from x
    select rno,min(from_sqn) from_sqn,max(to_sqn) to_sqn,dt
    from x_with_group
    group by rno,dt,sm
    order by rno,dt,from_sqn;
    RNO FROM_SQN TO_SQN DT       
    991        9     11 01-jan-2010
    991       15     44 01-jan-2010 Edited by: jeneesh on Feb 7, 2013 4:59 PM
    Assumed the date values are actually DATE types.
    Partition on DT and RNO can be amended as per your requirement..
    And assumed your sample data has a typo..
    If your data is correct..
    with x as
    select 991 rno, 9 from_sqn ,11 to_sqn ,to_date('2010-01-01','yyyy-mm-dd') dt
    from dual union all
    select 991, 15 ,22 ,to_date('2010-01-01','yyyy-mm-dd') from dual union all
    select 991, 22 ,33 ,to_date('2010-01-01','yyyy-mm-dd') from dual union all
    select 992, 33 ,44 ,to_date('2010-01-01','yyyy-mm-dd') from dual
    x_with_group as
    select rno,from_sqn,to_sqn,dt,
           sum(sm) over(order by from_sqn) sm
    from
      select rno,from_sqn,to_sqn,dt,
             from_sqn-
              nvl(lag(to_sqn) over(order by from_sqn),0) sm
      from x
    select min(rno) rno,min(from_sqn) from_sqn,max(to_sqn) to_sqn,min(dt) dt
    from x_with_group
    group by sm
    order by rno,dt,from_sqn;
    RNO FROM_SQN TO_SQN DT       
    991        9     11 01-jan-2010
    991       15     44 01-jan-2010 Edited by: jeneesh on Feb 7, 2013 5:14 PM

  • Combine multiple rows into single value

    I have the following results -
    id staff
    001 Joe
    001 Jim
    001 Dave
    002 Kim
    002 Pat
    002 Alan
    003 Peter
    004 Mick
    004 Paddy
    005 Steve
    005 Eric
    I want to have the results displayed as follows -
    id staff
    001 Joe,Jim,Dave
    002 Kim,Pat,Alan
    003 Peter
    004 Mick,Paddy
    005 Steve, Eric
    I have had a play about with this sort of thing before and I think SYS_CONNECT_BY_PATH will need to be used? Not really 100% sure though.
    All help will be appreciated.
    Cheers.

    Having a bit of trouble getting these solutions to work.
    Heres another example to try and show what my problem is...
    I have a table with the following -
    Region Country_name
    Britain England
    Britain Scotland
    Britain Wales
    Europe Spain
    Europe Italy
    Europe France
    Running the following Script...
    SELECT distinct region, SUBSTR (SYS_CONNECT_BY_PATH (country_name , ','), 2) csv
    FROM (SELECT region, country_name , ROW_NUMBER () OVER (partition by region ORDER BY region ) rn,
    COUNT (*) OVER (partition by region ) cnt
    FROM countries)
    WHERE rn = cnt
    START WITH rn = 1
    CONNECT BY rn = PRIOR rn + 1;
    I get the results ...
    Britain      England,Italy,Scotland
    Europe      England,Italy,France
    Britain      England,Wales,Scotland
    Britain      Spain,Wales,Scotland
    Europe      Spain,Italy,France
    Britain      Spain,Italy,Scotland
    Europe      England,Wales,France
    Europe      Spain,Wales,France
    Which is clearly wrong, I want
    Britain      England,Italy,Scotland
    Europe Spain,Italy,France
    and thats all!

  • Combining multiple rows into one row

    Hi all.
    My most humble apology for this question but solutions in previous threads did not seem to help much.
    Apparently, my account has not been verified and I am currently at home with no access to the SQL code so i can't post the actual code.
    We have this (mockup) of code
    Select S.C1, AViewSS.Study, AViewSS.SlotName, IST.TakenByDate, IST.ScannedByTime, SE.TimepointCalculation
    From IST
    INNER JOIN
    AViewSS ON IST.GroupID = AViewSS.GroupID and
    IST.SlotID = AViewSS.SlotID
    INNER JOIN
    S ON AViewSS.StudyID = S.StudyID
    INNER JOIN
    SE ON IST.Line = SE.Line and IST.SubLine = SE.SubLine and
    AViewSS.ScheduleID = SE.ScheduleID
    WHERE
    (IST.GroupID = 92) and (IST.SlotID between 1791 and 1795)
    and (AViewSS.VisitID = 137)
    The query currently returns this result set
    Col 1   Col 2   Taken Date  Date 1                Date 2               Date 3             
    Scanned DateTime
    Data    Data    3/12/2015  3/12/2015 7:22                                   
                    3/12/2015 7:22
    Data    Data    3/12/2015                            3/12/2015 8:47                         
    3/12/2015 8:47
    Data    Data    3/12/2015                                                    
    3/12/2015 9:27 3/12/2015 9:27
    Data    Data    3/22/2015                            3/22/2015 7:27        
                     3/22/2015 7:27
    Data    Data    3/22/2015
    Data    Data    4/12/2015
    Data    Data    4/12/2015
    Data    Data    4/12/2015
    You’ll notice that rows 1, 2, 3 are related as are rows 4, 5 and rows 6, 7, 8.
    This is what we ultimately want to see given the results above.
    In the report, rows 1, 2, 3 from the results should roll into one row with the ScannedByTimeStamp from each row returned by the query populating the appropriate report time column based on the value of a column in the row.
    Col 1   Col 2   Taken Date  Date 1                  Date 2                
    Date 3
    Data    Data    3/12/2015  3/12/2015 7:22    3/12/2015 8:47   3/12/2015 9:27
    Data    Data    3/22/2015                               3/22/2015 7:27  
    Data    Data    4/12/2015
    We would appreciate any guidance.

    Hi Duane,
    The table and matrix data regions can display complex data relationships by including nested tables,matrices, lists, charts and gauges. Tables and matrices have a tabular layout and their data comes from a single dataset, built on a single data source. The
    key diference between tables and matrices is that tables can include only row groups, where as matrices have row groups and columns groups.
    All Code in this sample are downloadable from
    this URL
    create procedure spMultiple
    as
    begin
    declare @Mytable table ([Col 1] varchar(20),[Col 2] varchar(20),[Taken Date] varchar(20),[Date 1] varchar(20),[Date 2] varchar(20),[Date 3] varchar(20))
    Insert into @Mytable ([Col 1],[Col 2],[Taken Date],[Date 1],[Date 2],[Date 3])
    select * from
    Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'3/12/2015 7:22' as [Date 1],'' as [Date 2],'' as [Date 3]
    union all
    Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'' as [Date 1],'3/12/2015 8:47' as [Date 2],'' as [Date 3]
    union all
    Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'3/12/2015 9:27' as [Date 3]
    union all
    select 'Data' as [Col 1],'Data' as [Col 2],'3/22/2015' as [Taken Date],'' as [Date 1],'3/22/2015 7:27' as [Date 2],'' as [Date 3]
    union all
    select 'Data' as [Col 1],'Data' as [Col 2],'3/22/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
    union all
    select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
    union all
    select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
    union all
    select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
    ) as temp;
    with Mytable2(
    [Col 1],
    [Col 2],
    [Taken Date],
    [Date],
    [NameDate]
    as
    SELECT
    [Col 1],
    [Col 2],
    [Taken Date],
    [Date],
    [NameDate]
    FROM
    (SELECT
    [Col 1],
    [Col 2],
    [Taken Date],
    [Date 1],
    [Date 2],
    [Date 3]
    FROM
    @MyTable) as p
    UNPIVOT
    [Date] FOR [NameDate] IN ([Date 1],[Date 2],[Date 3])
    )AS unpvt
    group by
    [Col 1],
    [Col 2],
    [Taken Date],
    [Date],
    [NameDate]
    Select * from Mytable2 t1 where [date]<>''
    end
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Ricardo Lacerda

  • Return and combine multiple rows in one record

    Hi friends,
    I have these cursors,
    DECLARE
    CURSOR plaintif_cur IS
    SELECT personel_id, sp_sfs_id
    FROM siv_plaintif
    WHERE SP_SFS_ID IN(70, 74, 182)
    ORDER BY personel_id;
    -- defendan cursor all defendan for a dept number
    CURSOR defendan_cur (v_sp_sfs_id siv_plaintif.SP_SFS_ID%TYPE) IS
    SELECT personel_id, sd_sfs_id
    FROM siv_defendan
    WHERE sd_sfs_id = v_sp_sfs_id
    AND SD_SFS_ID IN(70, 74, 182);
    BEGIN
    FOR plaintif_rec IN plaintif_cur LOOP
    dbms_output.put_line('Plaintif in Sivil '||TO_CHAR(plaintif_rec.sp_sfs_id));
    FOR defendan_rec in defendan_cur(plaintif_rec.sp_sfs_id) LOOP
    dbms_output.put_line('...plaintif is '||plaintif_rec.personel_id);
    END LOOP;
    END LOOP;
    END;
    The output generated was
    Output:
    Plaintif in Sivil 182
    ...plaintif is 38
    Plaintif in Sivil 70
    ...plaintif is 1257
    Plaintif in Sivil 74
    ...plaintif is 1277
    Plaintif in Sivil 74
    ...plaintif is 1278
    However, I want the output to be like this, especially for the record where there are many plaintifs in one Sivil file
    Desired Output:
    Plaintif in Sivil 182
    ...plaintif is 38
    Plaintif in Sivil 70
    ...plaintif is 1257
    Plaintif in Sivil 74
    ...plaintif is 1277, 1278
    I would like to thank those everyone helping.. Thank you.

    Instead of declaring two cursors and doing it in slowest possible manner, possibly you can combine it into one SQL. Search for string aggregation to get some queries in this regard.
    For more specific answer, please post your table structure (CREATE TABLE) and sample data (INSERT statement) with sample output desired. Format your code with tag.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Mapping and combining multiple rows

    Hi,
    Imaging the following case From R/3 every week to different customers 10 different products# are sold..If no new idem is sold for customer no new record is generated for this customer. For example -Source file:
    CustID     product #sold        number items
    1                1                     5
    1                2                     2
    1                3                     3
    3                2                     7
    4                1                    30
    In this case for custID 2 no sales were generated this week so no record exists in the text file. This file must be submitted to a partner for analysis in the following structure:
    Cust ID  product 1   product 2   product 3….
    1           5            2          3
    3                        7
    4          30
    It is going to be  text file structure after xi mapping and will be. Both files are fixed so each record and field has fixed positions predetermined.
    How would be the mapping in XI performed the best in this case..?Is using BMP necessary in this case or it could be avoided…and if yes how…?Looks like mapping program must be created. I  appreciate any input…The easy way is the better way..Of course I would like to handle some errors as well.
    Do i need any conversions in inbound/outbound File Adapter and what kind of if yes…?Thanks
    Jon

    hey
    >>case From R/3 every week to different customers 10 different products# are sold
    this means you are sending some values from R/3 to your partner,now this sender file,will this be an IDOC ?if yes,then which IDOC,if its gonna be a Flat file then can you provide us with the structure of the sender data type.
    also it will be helpful if you can send the receiver data structure as well
    Until now i dont see any need of BPM,it can be handled in message mapping but i can be more sure once i get the source and target data structure.
    Thanx
    Aamir

  • SQL to combine multiple rows

    Hi All -
    I have following 2 tables (definition and data insertion scripts below).
    COMP table has company related information and
    COMP_CATEGORY table has company category details.
    COMP- table
    COMP_ID | COMP_DESC | COMP_CITY | COMP_STATE
    1111|Sahara Ltd|Columbia|SC
    2222|Paragon Inc|Reno|NV
    3333|Skypx Solutions|Miami|FL
    create table COMP
    COMP_ID varchar2(100),
    COMP_DESC varchar2(200),
    COMP_CITY varchar2(50),
    COMP_STATE char(2)
    insert into COMP values ('1111','Sahara Ltd','Columbia','SC');
    insert into COMP values ('2222','Paragon Inc','Reno','NV');
    insert into COMP values ('3333','Skypx Solutions','Miami','FL');
    COMP_CATEGORY- table
    CAT_TYP_CDE | CAT_CDE | COMP_ID
    001|MO|1111
    001|OTHER|1111
    001|SDB|1111
    002|APAO|1111
    001|SDB|2222
    001|WO|2222
    001|MO|3333
    002|HAO|3333
    create table COMP_CATEGORY
    CAT_TYP_CDE varchar2(10),
    CAT_CDE varchar2(10),
    COMP_ID varchar2(100)
    insert into COMP_CATEGORY values ('001','MO','1111');
    insert into COMP_CATEGORY values ('001','OTHER','1111');
    insert into COMP_CATEGORY values ('001','SDB','1111');
    insert into COMP_CATEGORY values ('002','APAO','1111');
    insert into COMP_CATEGORY values ('001','SDB','2222');
    insert into COMP_CATEGORY values ('001','WO','2222');
    insert into COMP_CATEGORY values ('001','MO','3333');
    insert into COMP_CATEGORY values ('002','HAO','3333');
    The output I want from these 2 tables to display as a report is this:
    OUTPUT:
    COMP_ID | COMP_DESC | COMP_CITY | COMP_STATE | STATUS1 | STATUS2
    1111 | Sahara Ltd | Columbia | SC | MO,OTHER,SDB | APAO
    2222 | Paragon Inc | Reno | NV | SDB,WO | -
    3333 | Skypx Solutions | Miami | FL | MO | HAO
    So basically, companies can have 1 or 2 CAT_TYP_CDE in COMP_CATEGORY table i.e. with values '001' or '002'. if the company has CAT_CDE='MO' then it will have one more entry in COMP_CATEGORY table with CAT_TYP_CDE='002'. So as in the output shown above if the company has 'MO' category then it should show the corresponding '002' category value in STATUS2 column. If it doesnt have 'MO' then the STATUS2 column should be blank.
    Please share your expertise.
    Thanks,
    -Seenu

    Thanks for posting sample data.
    You're looking for string aggregation.
    Here are several techniques listed:
    http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php
    So basically, companies can have 1 or 2 CAT_TYP_CDE in COMP_CATEGORY table i.e. with values '001' or '002'. iIf that's a fixed rule, then you can try something like:
    SQL> with cc_agg1 as ( select comp_id
      2                   ,      ltrim(sys_connect_by_path(cat_cde, ','), ',') cat_cde1
      3                   from ( select comp_id
      4                          ,      cat_typ_cde
      5                          ,      cat_cde
      6                          ,      row_number() over ( partition by comp_id, cat_typ_cde order by cat_cde ) rn
      7                          from   comp_category cc
      8                          where  cat_typ_cde = '001'
      9                        )
    10                   where connect_by_isleaf=1
    11                   start with rn=1
    12                   connect by rn = prior rn+1
    13                          and comp_id = prior comp_id
    14                          and cat_typ_cde = prior cat_typ_cde    
    15                 )               
    16  ,    cc_agg2 as ( select comp_id
    17                   ,       cat_cde cat_cde2
    18                   from    comp_category cc
    19                   where  cat_typ_cde = '002'
    20                 )                              
    21  --
    22  select c.comp_id
    23  ,      c.comp_desc
    24  ,      c.comp_city
    25  ,      c.comp_state
    26  ,      cc1.cat_cde1
    27  ,      cc2.cat_cde2
    28  from   comp c
    29  ,      cc_agg1 cc1
    30  ,      cc_agg2 cc2
    31  where  cc1.comp_id = c.comp_id
    32  and    cc2.comp_id(+) = c.comp_id;
    COMP_ID    COMP_DESC       COMP_CITY  COMP_STATE CAT_CDE1        CAT_CDE2
    1111       Sahara Ltd      Columbia   SC         MO,OTHER,SDB    APAO
    2222       Paragon Inc     Reno       NV         SDB,WO
    3333       Skypx Solutions Miami      FL         MO              HAO

  • Combining multiple files in single 3D model

    We're struggling incorporating multiple .stl models to form a single file with an expandable model tree. Adobe v8.2.4, WinXP. We can get individual files on separate pages, but not embedded in the same page, such that you can select/hide individual objects. Is there a different file type we should be using rather than .stl?, are we missing something simple? thanks!

    Hi,
    The short answer is - "No".
    The Long Question - "Why do you want to use a SINGLE channel".
    If your idea is to reuse the interface then dont worry... Except for the Senderchannel and Sender agreement all your other objects can be reused ...provided your sender apter converts the different files into the same XML format..
    For TXT you can use the simple file adpater..
    For excel see if you can use save the file as .CSV format...then you can use it directlky by the simple FIle adapter..
    For PDF use conversion agent... Here a blog to get u started on that ->
    /people/shabarish.vijayakumar/blog/2009/05/17/trouble-writing-out-a-pdf-in-xipi
    regards
    Arvind R

  • Merging multiple rows in to a single row (when rows meet merging criteria)

    Hi 
    I have a scenario to merge multiple rows in to a single rows when the data in those rows fall in merge criteria .Below is how my data is 
    Now the merging logic for the above rows is , we need to combine multiple rows in to a single row when the data in those rows permits us to do in that way. Simply saying , its like sandwich where we combine multiple things to a single piece.The output for
    the above rows should be
    Here  we combined Row 1 ,2, 3 in to a single row as the data in those rows permits to merge in to single row. But the row 4 cannot be combined to any of those rows because the data in those rows doesn't permits us do a merge ( As the value of the column
    JobSource for the row 4 is different from the other rows ) .
    My original data has 56 columns , but for readability i kept only 9 columns. 
    can you please throw some idea on how to achieve this scenario. I know we need to use CTE for achieving this, but i am not able succeed in doing an iteration on multiple rows.
    Appreciate your response .

    Thanks for your reply .
    Rule for merging is simple . First of all there is no unique row identifier for each row , the fact table is not having an identity column in the database . I called row 1 , row 2  etc in my post above only to make better explanation of my scenario.
    The rule for merge is below. 
    1) we can combine only when the data in a column for one row is null & the data in same column for the other row is not null . It should also satisfy the condition where the data in other columns should conflict each other.
    2) Data for all columns for the merging rows should not be conflicting (i.e. we should not merge the rows when the data in a column is not equal to the same column in the other row
    ,considering not null value)
    Steps in merging the above source data :
    1) Consider the case of row 1 and row 2 in the source, we can combine these rows as the data is satisfying the rule 1 for columns (Jobsource,Flight, Package,Update,Iscancelled
    ,Result, Severity) and columns (JobID and RuleName ) fall under rule 2.  we merge these two rows in to a single row and keep in that in the table.
    2) Then the resulting row is again merged with the second row which is present above by applying the rule 1 and rule 2 . Below would be output of merge operation.
    Now there would be only two rows in the output . But these rows cannot be merged as the data doesn't satisfy the merge rules 2 . As Jobsource for the row 1 in the above output is "PresubmissionSource" which is not equal
    to "PostSubmission" jobSource which is in row 2. So these two rows are left unmerged .So the above two rows would be the output of merge operation on my source data.
    This process has to be repeated for all the rows in the table. As of now my table as 92 Million rows with 56 columns which need to be considered for merging rows. I replicated my scenario in 9 columns and 4 rows to understand better.

  • Extract Multiple Rows from a Single Table into a Single Row in a New Table

    I have a table in a database that contains contact data like name, address, phone number, etc.
    The folks who designed the database and wrote the application wrote it so that all contact records are placed in that table, regardless of contact type. In fact, the contacts table does not even have a column for "type" even though there are many
    different types of contacts present in that table.
    I am trying to write a mail merge style report in SRSS, that gets sent to a specific type of contact, based on criteria provided that must be obtained from another table, and that data is then used to get back to a specific set of contacts from the contacts
    table.
    The attached file directly below describes my problem and all related information in an extremely detailed way.
    SRSSMailMergeIssue.pdf
    Unless there is a way to make a SRSS Tablix point to two different data sets in SRSS, it looks like I have to combine multiple rows from the same table into a new table.
    If anyone can review the details in the attached pdf file and possibly point me in the direction I need to run to solve this probelm, I would greatly appreciate it.
    I also included a document (below) that shows the tables I reference in the probelm description.
    dbtables.pdf

    I found a solution.... and posted it below
    select
    dk.ucm_docketnumber [UCM DocketNumber],
    dk.ucm_docketid [UCM DocketID],
    vc.FirstName [Victim FirstName],
    vc.MiddleName [Victim MiddleName],
    vc.LastName [Victim LastName],
    vc.Suffix [Victim Suffix],
    vc.Address1_Line1 [Victim AddressLine1],
    vc.Address1_Line2 [Victim AddressLine2],
    vc.Address1_Line3 [Victim AddressLine3],
    vc.Address1_City [Victim City],
    vc.Address1_StateOrProvince [Victim StateProvince],
    vc.Address1_PostalCode [Victim Postalcode],
    oc.FirstName [Offender FirstName],
    oc.MiddleName [Offender MiddleName],
    oc.LastName [Offender LastName],
    oc.Suffix [Offender Suffix],
    oc.Address1_Line1 [Offender AddressLine1],
    oc.Address1_Line2 [Offender AddressLine2],
    oc.Address1_Line3 [Offender AddressLine3],
    oc.Address1_City [Offender City],
    oc.Address1_StateOrProvince [Offender StateProvince],
    oc.Address1_PostalCode [Offender Postalcode],
    pc.FirstName [Arresting Officer FirstName],
    pc.MiddleName [Arresting Officer MiddleName],
    pc.LastName [Arresting Officer LastName],
    pc.Address1_Line1 [Arresting Officer AddressLine1],
    pc.Address1_Line2 [Arresting Officer AddressLine2],
    pc.Address1_Line3 [Arresting Officer AddressLine3],
    pc.Address1_City [Arresting Officer City],
    pc.Address1_StateOrProvince [Arresting Officer StateProvince],
    pc.Address1_PostalCode [Arresting Officer Postalcode]
    FROM ucm_docket dk
    left outer join ucm_victim v on dk.ucm_docketid = v.ucm_docketnumber
    left outer join contact vc on vc.contactid = v.ucm_victimlookup
    left outer join ucm_offender o on o.ucm_offenderid = dk.ucm_offenderlookup
    left outer join contact oc on oc.contactid = o.ucm_individualid
    left outer join contact pc on pc.contactid = dk.ucm_ArrestingOfficerLookup
    WHERE (dk.ucm_docketnumber = @DocketNUM)

Maybe you are looking for

  • How can I import an m4v movie from my desktop to my event Library in iMovie?

    How can I import an m4v movie from my desktop to my event Library in iMovie?  I want to include the m4v movie into another project in iMovie.

  • SMS appears as a Network Notification message

    After loading the 4.5.0 version software in my Blackberry Curve (8310), I am facing a typical problem of my SMS being received as a Network Notification message by the Recipients. With this, in Nokia phones the message prompts for Save or Delete opti

  • Opening earlier CS docs in CS5 (Apple Mac)

    Whatever method I use, I cannot find any way to open earlier CS4 documents in the up-to-date CS5 (7.0.3) that I'm actually running right now. That includes resaving the earlier CS4 doc as an .imdl doc in the hope that my CS5 would then be able to ope

  • Garageband Keeps Quitting Unexpectedly

    Hello all, I've been having issues with Garageband and would appreciate any help/suggestions you can provide. Whenever I am done a project and go to open a new one, the program asks me if I want to save it with an iLife preview. No matter whether I h

  • Mail "To Do" Grayed Out

    I saw the other post of the same issue, which was closed and marked as resolved, but I could not find the answer within it. My "To Do" button is greyed-out in mail. It was there, but after performing some mac updates it is gone. I can post a new to d