Master/Detail? Repeating Tables - Combine data from 2 repeating tables to one cell in sharepoint

Hi there, new to infopath.  I have 2 sections in my form which are hidden and display based on the department selected.  So Department A versus Department B, a section opens for details pertaining to that Department.  So in each
section I have similar information requirements, similar but not exactly the same.  Now I was able to create hidden fields that will concat the values from both sections in the instances of similar data (i.e. Name, Department location, etc, so if Department
A fills in Name on their section, then someone else submits the same form for Department B I still have one column of metadata in SP to displace the Name regardless of department or section they filled data into). However now I am stuck, I have repeating
tables in both sections and I want to concate the entries to output to the sharepoint list for that cell.  However everything I have tried so far only concats the 1st value in the repeating table.  Is there a way to take ALL of the data from
two repeating tables and merge them into one column/cell in sharepoint (metadata for the one form entry)???  I want to avoid having to create a excessive "views" of a list in order to accomodate the needs for BOTH departments.  I hope
this is clear.  Thanks for your help!
from msn forum

Hi Meera,
    I apologise for delay. Anyways you can goto the
following link:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/36f08758-0a01-0010-c291-c03004aeb1af
for details.
Hope this will clear you. However, you further require
any more information then please feel free to mail.
Note:
ty_t_sender, cl_abap_char_utilities DEFINITION LOAD
all these are present in alsmex function group if you
place your function module in this function group then
you'll be able to access these things. Further, like
if you have security options and can't place your code
in this function group then create your own function
group in your own package and copy the contents from
alsmex function group.
    Hope that answer your questions.
Regards,
Mirza Ifthekhar Baig.

Similar Messages

  • Populate ADF Rich Table taking data from two tables of database

    Hi,
    Can anyone please guide me as to how I can populate ADF Rich Table taking data from two tables A and B of a database.
    The condition is
    I want to fetch row 1 from table A and populate into ADF Rich Table at row 1
    then
    I want to fetch row 1 from table B and populate into ADF Rich Table at row 2
    and so on....
    Many thanks for your help..
    Regards,
    Rohit

    The better place where you will learn:
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcquerying.htm

  • Drop Down list in table with data from database table

    Hi,
    I have created an interactive form in WD ABAP.
    In Context tab I have created the nodes as follows:
    ZSOHEADER node with cardinality 1..1
    |-> MATERIAL node with cardinality 0..n. Under MATERIAL node there are 2 attrib. MAKTX and MATNR.
    I am fetching data from MARA table into an internal table IT_MARA.
    The node MATERIAL is bound to internal table IT_MARA.
    I have created a table with property ' Body rows vary depending on data ' .
    I have only one row in table. The first cell of the row is a drop down field.
    I have bind the field to the node MATERIAL->DATA->MAKTX.
    Now the issue is even though I have created only one row in my table, in preview it is creating as many rows in the table as the no.of records in the internal table.
    I want only one row with the drop down list containing all values of the internal table.
    Kindly suggest what to do.
    Regards,
    Vinod

    Hi,
    In the WebDynpro Context, in the main node create another node like A1 with cardinality 0..n and in this node create attributes TEXT and VALUE.
    Now goto method and in that method using code wizard read the node A1.
    And use the below code snippet sample in your program, i.e. code this under respective method of the webdynpro.
    *Declare the TYPES
    TYPES : BEGIN OF TY_TABLE,
    TEXT TYPE SOMETYPE,
    VALUE TYPE SOMETYPE,
    END OF TY_UOM.
    *Define Internal Table and work area.
    DATA : IT_TABLE TYPE STANDARD TABLE OF TY_TABLE INITIAL SIZE 0,
    WA_TABLE TYPE TY_TABLE.
    SELECT TEXT VALUE FROM TABLENAME INTO TABLE IT_TABLE.
    lr_node_info->bind_table( IT_TABLE ).
    And in the Adobe Form Layout
    Go to Menu of the Adobe LiveCycle Designer:
    Tools>Options..>DataBinding
    In that window you just check the Show Dynamic properties Check Box.
    Now for the Drop Down go the binding tab in object palette and click on the list items and there specify the Internal Table and specify the text as the internal table text field and value as internal table value field.
    OR
    From the WebDynpro Native Library Palette use the Value Help Drop Down and in object pallette goto binding tab and provide the form interface binding. Before this in the WebDynpro goto Context and for the particular field under the properties provide the search help as dictionary search help and specify the name of the dictionary search help.
    OR
    We have another method of setting the Text and Value to the DDL directly in the WebDynpro by coding in the methods, I dont have much knowledge on this.
    Regards
    Pradeep Goli

  • Combine data from 2 tables

    I'm trying to tell CR XI R2 to use all the data from Table A Column 1, then use whatever is in Table B Column 1 that does not match the data in Table A Column 1.
    I've been trying IF statements in both Crystal and MS Access. It's probably simple...but it's Monday and I'm just not getting it.
    Thanks in advance.

    Here's the SQL copied from the view SQL. I've tried with double quotes, single quotes, and no quotes on the fields, but still get the same error. I don't want to even try and edit it until it will compile without the error.
    What I really want is all data from vFacility_Employee (the left table) and only those records from vRounding_Summary (right table) that match a time frame parameter based on the Date field in that table.
    Thanks for any help you can provide! ldc
    ORGINAL SQL: SELECT vRounding_Summary.Number_Employees, vRounding_Summary.Info_Id, vFacility_Employee.FacDesc, vFacility_Employee.FacHR, vFacility_Employee.Facility_Employees, vRounding_Summary.Date
    FROM Leader_Rounding.Rnd.vFacility_Employee vFacility_Employee
    LEFT OUTER JOIN Leader_Rounding.Rnd.vRounding_Summary vRounding_Summary ON vFacility_Employee.LKP_RegionFacilityID=vRounding_Summary.Facility_Id
    WHERE (vFacility_Employee.FacHR='0301' OR vFacility_Employee.FacHR='0305' OR vFacility_Employee.FacHR='0309' OR vFacility_Employee.FacHR='0310' OR vFacility_Employee.FacHR='0314' OR vFacility_Employee.FacHR='0338' OR vFacility_Employee.FacHR='0340' OR vFacility_Employee.FacHR='0342' OR vFacility_Employee.FacHR='0380' OR vFacility_Employee.FacHR='0382' OR vFacility_Employee.FacHR='0384' OR vFacility_Employee.FacHR='0414' OR vFacility_Employee.FacHR='0415' OR vFacility_Employee.FacHR='0420' OR vFacility_Employee.FacHR='0426' OR vFacility_Employee.FacHR='0427' OR vFacility_Employee.FacHR='5300' OR vFacility_Employee.FacHR='5305' OR vFacility_Employee.FacHR='5312' OR vFacility_Employee.FacHR='5322' OR vFacility_Employee.FacHR='5355' OR vFacility_Employee.FacHR='5397')
    SQL if I add the Date from the right table as a Select record option.  The problem with this SQL is that I lose all those records from the left join table that have no dat in the right table.
    SELECT "vRounding_Summary"."Number_Employees", "vRounding_Summary"."Info_Id", "vFacility_Employee"."FacDesc", "vFacility_Employee"."FacHR", "vFacility_Employee"."Facility_Employees", "vRounding_Summary"."Date"
    FROM   "Leader_Rounding"."Rnd"."vFacility_Employee" "vFacility_Employee"
    LEFT OUTER JOIN "Leader_Rounding"."Rnd"."vRounding_Summary" "vRounding_Summary" ON "vFacility_Employee"."LKP_RegionFacilityID"="vRounding_Summary"."Facility_Id"
    WHERE  ("vFacility_Employee"."FacHR"='0301' OR "vFacility_Employee"."FacHR"='0305' OR "vFacility_Employee"."FacHR"='0309' OR "vFacility_Employee"."FacHR"='0310' OR "vFacility_Employee"."FacHR"='0314' OR "vFacility_Employee"."FacHR"='0338' OR "vFacility_Employee"."FacHR"='0340' OR "vFacility_Employee"."FacHR"='0342' OR "vFacility_Employee"."FacHR"='0380' OR "vFacility_Employee"."FacHR"='0382' OR "vFacility_Employee"."FacHR"='0384' OR "vFacility_Employee"."FacHR"='0414' OR "vFacility_Employee"."FacHR"='0415' OR "vFacility_Employee"."FacHR"='0420' OR "vFacility_Employee"."FacHR"='0426' OR "vFacility_Employee"."FacHR"='0427' OR "vFacility_Employee"."FacHR"='5300' OR "vFacility_Employee"."FacHR"='5305' OR "vFacility_Employee"."FacHR"='5312' OR "vFacility_Employee"."FacHR"='5322' OR "vFacility_Employee"."FacHR"='5355' OR "vFacility_Employee"."FacHR"='5397') *AND ("vRounding_Summary"."Date">={ts '2010-03-01 00:00:00'} AND "vRounding_Summary"."Date"<{ts '2010-04-01 00:00:00'})*
    Edited by: ldclem on Mar 16, 2010 4:48 PM
    Edited by: ldclem on Mar 16, 2010 4:53 PM

  • How to combine data from two rows into one row

    I have the following sets of data. I want to find all the duplicate sets of field values. in the data below there is only one duplicate set: brenda, analyst, green.
    DocID and Doc Seq combine to form the set key. FieldID I believe are consistent in that 1 is always name, 2 is job, 3 is favorite color etc. but there are up to 20 field IDs.
    To tell you the truth, my client is a bit sketchy about the data and the values. I would like collapse the sets by getting all the field values into a single row. They could be in the same column, or in their own columns. This way I can then look for whatever
    dups my customer seems to think that he has.
    the first image is what i want (either in same column or in different columns. but they have to be in the order of the FieldID), the second is what i have. THANKS

    CREATE TABLE #t (
    c1 INT NOT NULL PRIMARY KEY,
    c2 VARCHAR(50) NOT NULL
    GO
    INSERT INTO #t(c1, c2) VALUES(1, 'P1,P2,P3')
    INSERT INTO #t(c1, c2) VALUES(2, 'P2,P3')
    GO
    -- Generate set of numbers
    -- Idea from Itzik Ben-Gan
    ;WITH
    L0 AS (SELECT 1 AS n UNION ALL SELECT 1),
    L1 AS (SELECT 1 AS n FROM L0 AS a, L0 AS b),
    L2 AS (SELECT 1 AS n FROM L1 AS a, L1 AS b),
    L3 AS (SELECT 1 AS n FROM L2 AS a, L2 AS b),
    L4 AS (SELECT 1 AS n FROM L3 AS a, L3 AS b),
    Numbers AS (SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS Number FROM L4)
    SELECT
    t.c1,
    t.c2,
    SUBSTRING(',' + t.c2 + ',', Number + 1, CHARINDEX(',', ',' + t.c2 + ',', 
    Number + 1) - Number - 1) AS Item,
    ROW_NUMBER() OVER(PARTITION BY t.c1 ORDER BY n.Number) AS rn
    FROM
    #t AS t, Numbers AS n
    WHERE
    n.Number <= LEN(t.c2)
    AND SUBSTRING(',' + t.c2 + ',', n.Number, 1) = ','
    ORDER BY
    t.c1, rn
    GO
    DROP TABLE #t
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • To populate dynamically created int table with data from other table

    Hi everybody,
    I have already created an internal table dynamically, but now want to populate it with data from another IT depending on the plant name.
    My dynamic int table contains fields with plant name like '8001' ,'8002' and so on.
    no I want to read data from the other table and depending on bwkey which contains similar data like plant name , want to append to this new dynamic int table through read key statement.
    I cannot reference the field name hard coded as it does not allow field symbol reference to be hard coded.
    Pls help.

    Hi,
    Check the code below:
    REPORT  ztestdyn.
    TYPE-POOLS : slis.
    TABLES: yyle0003.
    DATA:
      g_exit    TYPE c,
      g_save    VALUE 'A',               "For parameter I_SAVE
      g_repid   LIKE sy-repid,           "For program name
      g_variant TYPE disvariant.         "For parameter IS_VARIANT
    *Tables
      DATA: d_ref TYPE REF TO data,
            d_ref1 TYPE REF TO data,
            i_alv_cat1 TYPE TABLE OF lvc_s_fcat,
            ls_alv_cat1 LIKE LINE OF i_alv_cat1.
      DATA: BEGIN OF total_tab OCCURS 0 ,
            tknum TYPE yyle0003-tknum,
            quantity TYPE p,  "yyle0003-QUANTITY,
            END OF total_tab.
      DATA: BEGIN OF g_scandata_tab OCCURS 0.
              INCLUDE STRUCTURE yyle0003.
      DATA: END OF g_scandata_tab.
      DATA: g_yyle0003_tab LIKE yyle0003 OCCURS 0 WITH HEADER LINE.
      DATA: g_itab1 TYPE TABLE OF yyle0003.
      DATA: wa_itab1 LIKE g_scandata_tab.
      TYPES: BEGIN OF itab2,
             tknum TYPE yyle0003-tknum,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab2.
      DATA: g_itab3 TYPE TABLE OF itab2.
      DATA: wa_itab3 TYPE itab2.
      DATA: g_itab5 TYPE TABLE OF itab2.
      DATA: wa_itab5 TYPE itab2.
      DATA: g_itab4 TYPE TABLE OF itab2.
      DATA: wa_itab4 TYPE itab2.
      DATA: gv_wa TYPE REF TO data.
      DATA : wa_tab TYPE itab2.
      DATA: BEGIN OF itab6 OCCURS 0,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab6.
    ******************Start of Internal Table Definition *******************
      DATA:
            g_custom_container_0100 TYPE REF TO cl_gui_custom_container,
            g_alv_grid_0100    TYPE REF TO cl_gui_alv_grid,
            g_container_0100   TYPE scrfname VALUE 'LIST',
            g_mylayout         TYPE lvc_s_layo,
            ok_code            LIKE sy-ucomm.
      FIELD-SYMBOLS :<f_fs> TYPE table,
                     <f_fs11> TYPE table,
                     <f_fs1> TYPE table,
                     <f_fs3> TYPE ANY,
                     <f_fs4> TYPE ANY,
                     <f_field> TYPE ANY,
                     <f_fs5> TYPE ANY.
      FIELD-SYMBOLS: <fs_wa> TYPE ANY.
      DATA: l_var TYPE i,
            l_i   TYPE i.
      DATA: l_var1 TYPE char20,
            l_var2 TYPE char20.
    DATA: l_TOTAL TYPE I,
          L_FILL TYPE i,
          L_TOT  TYPE I.
    DATA: l_int TYPE i,
           l_sum TYPE i.
    FIELD-SYMBOLS: <f_fs2> TYPE  itab2, "
                     <f_fs6> TYPE ANY,
                     <f_fs7> TYPE ANY.
      DATA: l_var3 TYPE char15.
      DATA: l_quant TYPE p.
    FIELD-SYMBOLS: <f_fs8> LIKE itab6, "
                     <f_fs9> TYPE ANY,
                     <f_fs10> TYPE ANY.
    FIELD-SYMBOLS : <f_fs12> TYPE ANY,
                      <f_fs13> TYPE ANY.
      SORT g_scandata_tab BY tknum vhilm.
      LOOP AT g_scandata_tab INTO wa_itab1.
        MOVE-CORRESPONDING wa_itab1 TO wa_itab3.
        APPEND wa_itab3 TO g_itab3.
      ENDLOOP.
      LOOP AT g_itab3 INTO wa_itab3.
        COLLECT wa_itab3 INTO g_itab4.
      ENDLOOP.
      LOOP AT g_itab4 INTO wa_itab4.
        MOVE-CORRESPONDING wa_itab4 TO wa_itab5.
        MOVE-CORRESPONDING wa_itab4 TO itab6.
        APPEND wa_itab5 TO g_itab5.
        COLLECT itab6.
      ENDLOOP.
      CLEAR wa_itab3.
      SORT g_itab4 BY tknum vhilm.
      DELETE ADJACENT DUPLICATES FROM g_itab4 COMPARING vhilm.
      DESCRIBE TABLE g_itab4 LINES l_var.
      l_i = '2'.
      ls_alv_cat1-fieldname = 'TKNUM'.
      ls_alv_cat1-col_pos = 1.
      ls_alv_cat1-coltext ='ShipmentNo.'.
      APPEND ls_alv_cat1 TO i_alv_cat1.
      DATA: l_var4(10) TYPE c,
            l_var5(10) TYPE c,
            l_fieldname(20) TYPE c..
      LOOP AT g_itab4 INTO wa_itab4.
        IF l_var >= 1.
          CONDENSE wa_itab4-vhilm NO-GAPS.
          ls_alv_cat1-fieldname = wa_itab4-vhilm. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = wa_itab4-vhilm.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
          l_i = l_i + 1.
        ENDIF.
        AT LAST.
          ls_alv_cat1-fieldname = 'TOTAL'. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = 'TOTAL'.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
        ENDAT.
        SORT i_alv_cat1 BY fieldname.
        DELETE ADJACENT DUPLICATES FROM i_alv_cat1.
      ENDLOOP.
      SORT i_alv_cat1 BY col_pos.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_alv_cat1
        IMPORTING
          ep_table = d_ref.
      ASSIGN d_ref->* TO <f_fs>.
      CREATE DATA gv_wa LIKE LINE OF <f_fs>.
      ASSIGN gv_wa->* TO <fs_wa>.
      DELETE ADJACENT DUPLICATES FROM <f_fs> COMPARING ALL FIELDS.
        LOOP AT itab6.
        CLEAR wa_itab5.
        wa_itab5-tknum = 'Total'.
        MOVE-CORRESPONDING itab6 TO wa_itab5.
        APPEND wa_itab5 TO g_itab5.
        CLEAR wa_itab5.
      ENDLOOP.
         DESCRIBE TABLE g_itab5 LINES L_TOT.
           LOOP AT TOTAL_TAB.
          L_TOTAL = L_TOTAL + total_tab-quantity.
         ENDLOOP.
      LOOP AT g_final ASSIGNING <f_fs2>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <f_fs2> TO <f_fs6>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <fs_wa> TO <f_fs7>.
        <f_fs7> = <f_fs6>.
        CONDENSE <f_fs2>-vhilm NO-GAPS.
        ASSIGN COMPONENT 'VHILM' OF STRUCTURE <f_fs2> TO <f_fs3>.
        ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
        MOVE <f_fs3> TO l_var1.
        ASSIGN COMPONENT l_var1 OF STRUCTURE <fs_wa> TO <f_fs5>.
        <f_fs5> =  <f_fs4>.
        CLEAR total_tab-quantity.
        READ TABLE total_tab WITH KEY tknum = <f_fs6>.
        IF sy-subrc = 0.
          ASSIGN total_tab-quantity TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        L_FILL = L_FILL + 1.
        IF L_FILL = L_TOT.
         ASSIGN L_TOTAL TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        AT END OF <f_fs2>-tknum.
          APPEND <fs_wa> TO <f_fs>.
          CLEAR  <fs_wa>.
        ENDAT.
      ENDLOOP.
      CLEAR: <f_fs6>,
              <f_fs7>.
      CLEAR <fs_wa>.
    CALL SCREEN 0100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZVKS'.
      SET TITLEBAR 'ZVKS'.
      CHECK sy-ucomm IS INITIAL.
      SORT g_scandata_tab BY tknum vhilm.
      CREATE OBJECT g_custom_container_0100
             EXPORTING container_name = g_container_0100
             EXCEPTIONS
               cntl_error = 1
               cntl_system_error = 2
               create_error = 3
               lifetime_error = 4
               lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT g_alv_grid_0100
             EXPORTING i_parent = g_custom_container_0100.
      g_mylayout-grid_title = 'Display Scanning data'.
      CALL METHOD g_alv_grid_0100->set_table_for_first_display
        CHANGING
          it_outtab                     = <f_fs>
          it_fieldcatalog               = i_alv_cat1
                    EXCEPTIONS
                      invalid_parameter_combination = 1
                      program_error                 = 2
                      too_many_lines                = 3
                      OTHERS                        = 4.
      IF sy-subrc <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Regards
    Kannaiah

  • Populating table with data from another table with fewer columns

    Hi,
    I have 2 tables:
    Table 1:
    Column 1
    Column 2
    Column 3
    Table 2:
    Column 1
    Column 2
    I want to populate Table 1 with all the data from Table 2, and populate Column 3 of Table 1 with numbers from a sequence. Is there a SQL stmt to do this? If not, what is the best way to do it in PL/SQL?
    Thank you
    Shailan

    CREATE SEQUENCE t1_seq
    START WITH 1
    INCREMENT BY 1
    CACHE 100;
    INSERT INTO t1( col1, col2, col3 )
      SELECT col1, col2, t2_seq.nextval
        FROM t2Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Combining data from multiple tables into report

    I'll try my best to describe my issue accurately.
    I bring in two tables and link them together in my report. First table is a Location table.   I create a running total field to summarize the location details in order to to produce total square footage for each location.  Let's say the total square footage for Building A is 100,000 ft.².
    The second table is an Employee table. This table lists the details of each employee. Each employee record contains a location ID that allows me to link this table to the Location table.  Within the report I create a running total field to summarize the total number of employees for each location.  Let's say the total number of employees for building a is 12.
    Now, I have a group footer which contains the name of each location. Next to the location name I insert my first running total field which summarizes the location details and provides the total square footage.  In my example Building A = 100,000 square-foot.
    now I'm ready to insert my second running total field which summarizes the number of employees within each location. In my example, Building A =12 employees.  The moment I insert my second running total field, the square footage from the first running total field changes to 1,200,000 ft.². I can see the correlation between the number of employee records which is 12 and the change in square footage.
    Where am I going wrong??  Please help....
    THANKS

    Please post DDL+DML!
    DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and reproduce the problem in our server. Without DDL no one
    can execute any query.
    How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
    DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
    sample data.
    If you post a "create query" for the tables and "insert query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps to identify issues,
    clarify terminology and prevent incorrect assumptions.  Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
    [Personal Site] [Blog] [Facebook]

  • Combine data from a table and insert to another in comma separated format

    In my SQL database table i have some data as shown below.
    KNO       Course      Grade     Institution
    124        BTECH       First       IIT Calicut
    128        BE             First       KKS Institute
    124        CCNA         Q          NIIT Delhi
    124        DDCN         Q          Appl Calicut
    128        DIT            A         NIIT Delhi
    128        VB              Q        IICM Delhi
    i want this courses to be arranged as sample given under to a table named mainpers
    KNO    Course    
    124     BTECH[First], CCNA[Q],DDCN[Q]
    128     BE[First], DIT[A], VB[Q] 
    I am a System Administrator at Vadodara

    You can do this in SQL.
    with cte as (
    select distinct KNO
    from Table1
    select KNO
    , Stuff(
    (select ',' + Course + '[' + Grade + ']'
    from Table1
    where Table1.KNO = cte.KNO
    for xml path ('')
    ), 1, 1, '') as Course
    from cte
    http://davidduffett.net/post/5334646215/get-a-comma-separated-list-of-values-in-sql-with-for
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Error in Abap code when combining data from two tables

    Hi,
    I got error in my code when  i try to select data based on two tables
    error message Unknown column name "(" field list. field list. field list. field list.
    select ( WLK1~ARTNR )
              into ZOXE1D0041-ZZPROMO
              from WLK1 INNER JOIN T001W
              ON WLK1FILIA = T001WKUNNR.
              where WLK1-PFLKN NE 'P' AND
              WLK1-QUELL NE '2'.
    Table 1 WLK1
    ARTNR   FILIA       PFLKN                  QUELL
    001         C001        P                           2
    002         C001        A                          1
    Table 2  T001W
    KUNNR                WERKS
    C001                    P001
    My requirement is to extract from article number from table WLK1 where the customer number (FILIA) matches with Customer number from (T001W) and plant (WERKS).
    In conclusion I like to have this only this row
    ARTNR   FILIA       PFLKN                  QUELL
    002         C001        A                          1

    Hi
    You need to append every article number after each select is performed
    is this an intermal table ZOXE1D0041 with header line ? if yes
    then do this way
    select WLK1~ARTNR
    into ZZARTICLE
    from WLK1 INNER JOIN T001W
    ON WLK1FILIA = T001WKUNNR
    where WLK1~PFLKN NE 'P' AND
    WLK1~PFLKN NE 'S' AND
    WLK1~QUELL NE '2'.
    ZOXE1D0041-ZZLISTARTICLE = ZZARTICLE.
    Append ZOXE1D0041.  " <edited>
    endselect.
    then ZOXE1D0041 will have all article numbers.
    Edited by: Sonal Patel on Sep 5, 2009 10:27 AM

  • Update a table with data from another table

    Hi to All,
    I have in my 'schema' 2 tables:
    CREATE TABLE T_ITEMS
    ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
    ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
    ITEM_DESCRIPTION VARCHAR2(40 BYTE) NOT NULL,
    ITEM_QTA NUMBER(16,4),
    ITEM_PRICE NUMBER(18,5)
    TABLESPACE DOM8DATI
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 2M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE TABLE T_PRICES
    ITEM_GROUP VARCHAR2(10 BYTE) NOT NULL,
    ITEM_CODE VARCHAR2(25 BYTE) NOT NULL,
    ITEM_PRICE NUMBER(18,5)
    TABLESPACE DOM8DATI
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 2M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    I need to create a script that for each record in T_ITEMS, read if exist the code (ITEM_GROUP,ITEM_CODE) in T_PRICES and update ITEM_PRICE in T_ITEMS.
    Can anyone help me?
    Thank You and Best Regards
    Gaetano

    MERGE INTO T_ITEMS B USING (
    SELECT
    ITEM_GROUP ,
    ITEM_CODE,
    ITEM_PRICE
    FROM T_PRICES) E
    ON (B.ITEM_CODE= E.ITEM_CODE)
    WHEN MATCHED THEN
    UPDATE SET B.ITEM_PRICE= E.ITEM_PRICE
    WHEN NOT MATCHED THEN
    INSERT (ITEM_GROUP ,
    ITEM_CODE,
    ITEM_DESCRIPTION ,
    ITEM_QTA ,
    ITEM_PRICE )
    VALUES (E.ITEM_GROUP,
    E.ITEM_CODE,
    'UNKNOWN',
    'UNKNOWN',
    E.ITEM_PRICE);
    COMMIT;

  • Updating a table with data from another table with joins involving 3 other

    update party_relship pr
    set pr.COMMENT_TEXT = temp.notes
    from party p,
    party p1,
    party_reference pref,
    TEMP_DEPT_NOTE temp
    where pr.FROM_PARTY_ID = p.PARTY_ID
    and p.CMA_CUSTOMER_NUMBER = temp.cma_num
    and pr.TO_PARTY_ID = p1.PARTY_ID
    and p1.PARTY_ID = pref.PARTY_ID
    and pref.REFERENCE_VALUE = temp.deptnum
    ORA-00933: SQL command not properly ended
    What is the problem here.
    Thanks !

    There are a few issues here 1) no from clause is directly part of the update stmt,
    2) temp.notes is not available directly
    I am not 100% sure this update is correct since I am selecting temp.notes using the same query as the in the where clause but I wanted to show the complete syntax. Basically if you need to limit the number of updates done then change the select that is part of the exists clause, if you need to change the way the pr.comment_text is being set then to need to change the sub_query.
    update party_relship pr
    set pr.comment_text =
                     (select temp.notes
                      from   party p,
                             party p1,
                             party_reference pref,
                             temp_dept_note temp
                      where  pr.from_party_id = p.party_id
                      and    p.cma_customer_number = temp.cma_num
                      and    pr.to_party_id = p1.party_id
                      and    p1.party_id = pref.party_id
                      and    pref.reference_value = temp.deptnum)
    where  exists(select 1
                  from   party p,
                         party p1,
                         party_reference pref,
                         temp_dept_note temp
                  where  pr.from_party_id = p.party_id
                  and    p.cma_customer_number = temp.cma_num
                  and    pr.to_party_id = p1.party_id
                  and    p1.party_id = pref.party_id
                  and    pref.reference_value = temp.deptnum)Message was edited by:
    Bob C

  • How to Copy complete structure of a table with data from one database table to another databse table

    I need a sql query to copy structure of table with data from production table of ONLINEBTREKDB database to production table of Archive database.
    I tried this query
    select * into Archive.dbo.Production from ONLINEBTREKDB.dbo.Production p
    but problem is I am able to copy the table schema and data but not able to copy constraints(PK)
    Any Help?
    seema

    You've multiple options
    1. Use generate scripts wizard available in SQL management studio. This is particularly helpful when you want to script out lot of objects. You can also choose to script data as well inside this. This can be launched by right clicking the db, choosing tasks
    -> generate scripts and then selecting required options inside the wizard
    2. Use object explorer and right click and script out table. You can also use search functionality to find object you want inside object explorer
    http://visakhm.blogspot.in/2013/02/object-filtering-using-ssms-object.html
    3. Use query based on INFORMATION_SCHEMA views like TABLES,COLUMNS,CONSTRAINT_COLUMN_USAGE etc to generate the script
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • OBIEE 11g - Combine data from two Oracle tables

    Good day!
    I tried to combine data from two Oracle tables as fact data, but it doesn't work.
    My steps: I created SCOTT.EMP2 table from SCOTT.EMP table, update EMPNO and ENAME values of EMP2 table to distinguish data of my tables. Then I imported physical tables DEPT, EMP and EMP2 to BIEE 11g, created joins DEPT-EMP and DEPT-EMP2 in physical diagram. Then I dragged DEPT and EMP tables to BMM, and EMP2 table to EMP as second LTS. In Content tab for EMP and EMP2 I checked "This source should be combined with other sources at this level" checkboxes. Then I renamed logical tables EMP and DEPT to Employees and Departments and dragged them to Presentation area. In Answers I created Analysis with columns DNAME and ENAME.
    The problem is that data on results tab is only from one physical table EMP or EMP2 (depending on the order of sources EMP and EMP2 of LT Employees) and not from both.
    Can anybody help? Am I missed something?
    Al.

    Hi Al,
    I think you have to define the content of the LTS.
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_BusModSetup16.html
    You have to specify the content of the different fragments.
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_SetUpAggNav3.html#wp1005333
    Maybe you have to add an additional column 'Source' ('EMP1', 'EMP2')
    Good Luck,
    Daan Bakboord
    http://obibb.wordpress.com

  • Approaches to transfer changed data from a table to another table

    Hello expert,
    will you please show me all approaches to automatically detect and transfer changed data from a table to another table ? I don't need detail information, but a little comment for those approaches are more welcome.
    Many Thanks,
    Edited by: 843178 on 19-Dec-2011 2:04 PM

    You will want to review information on replication and similar methods
    In a nutshell:
    Replication allowed data to exist at more than one site and take the Master / original table data and clone it at a different site
    As tranporting all of the table data to a remote / clone site got more and more expensive we developed a method
    to identify just the 'diffs' and only send those from the master to the clone which needed only the diffs to become a clone of the master table
    This has many methods and options, but looking under key words such as
    - distributed transations
    - materialized views
    - replication
    ... are a few categories that will get you started

Maybe you are looking for