Concatenate multiple tables into one table

Dear all,
I am doing migration between two database structures, that's why I need also to know if we want to concatenate the data in tables A,B and C into one table in the destination schema, what is the strategy to do this knowing that I have a lot of data and I need the fastest solution.
regards

Since the details of your requirements are unclear, will this approach not work ?
SQL> INSERT into target_table
SQL> (SELECT * from tableA UNION
SQL>  SELECT * from tableB UNION
SQL>  SELECT * from tableC);HTH
Srini

Similar Messages

  • Using DATA_CELL and multiple queries into one table

    Hi WAD experts,
    I have been trying to work out how to combine multiple hidden query result sets in their own tables in the template, into one table displayed as if the data originated from one query.
    I have been looking at using the DATA_CELL method of "modify table" class.
    Has anyone had to do this before - and if so do you have any clues as to how best to do this ?
    Thanks
    Chris

    Here is what I want:
    Say I have a query that tells me about how many items were sold at a hardware store for each week. Then the output would look something like this:
    Week,Item,Num_Sold
    13,Hammer,15
    13,Nail,594
    13,Screw,398
    14,Hammer,16
    14,Nail,382
    14,Screw,331
    But I want my output to look like this:
    <space>,13,14 <-- these would be the week numbers
    Hammer,15,16
    Nail,594,382
    Screw,398,331
    I asked this same question in a SQL-only forum and one person responded that they did not know how to do that. But I figure that this is done often enough that there must be some Open Source program that can transform the output data into a table. As you can see, it's not a pure transform. It's more like I take one column, make that the x-axis, another column, make that the y-axis, and "plot" the data based on the two columns. It's kinda like taking 1D data and making it 2D. There's no existing open source program which does this? I figure that I could just give the program my SQL queries, specify some rule such as "Make the first column of the resultset the row, make the second column the column and create a table with the 3rd row, using the first two rows to map the 3rd row into the table". Note that I think this only works with 3 columns.
    Anyway, if there is no simple program that already does this, I can make a program to do what I just described. I just asked the question here because I figure that there are a lot of people knowledgeable about SQL and Java on this forum and that someone would know of a tool which already does what I want if one exists.

  • Combine Multiple Worksheets into one table

    Hello Everyone!
    I have 2 Excel worksheets within the same workbook. Both have identical tables with almost the same fields except for 2 or 3 different columns in one of the sheets. Currently I have a macro assigned to a button on one of the sheets and I have to click on
    it to combine the 2 sheets. I also have a Pivot Table on one of the sheets which pulls data from the table on that sheet and displays it on the existing sheet.
    I wish to :
    1. Combine (merge) these two sheets into one table on a new worksheet when Excel file is opened rather than clicking on the button.
    2. Once the Excel file is opened, i would like to have the Pivot Table to pull data off the combined sheet and display it next to the combined table. Essentially I would like the Pivot Table to be refreshed with the new data from the Combined table rather
    than from one table.
    Is this possible ?
    I use the following code to combine the two sheets, but I don't know how to proceed further. Can someone please help me with the rest ?? Thanks in advance.
    Here's the code:
    Option Explicit
    Sub Combine()
    Dim J As Integer
    On Error Resume Next
    Sheets(1).Select
    Worksheets.Add
    Sheets(1).Name = "Combined Results"
    Sheets(2).Activate
    Range("A1").EntireRow.Select
    Selection.Copy Destination:=Sheets(1).Range("A1")
    For J = 2 To Sheets.Count
    Sheets(J).Activate
    Range("A1").Select
    Selection.CurrentRegion.Select
    Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
    Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
    Next
    End Sub
    The problem with being punctual is, there's nobody there to appreciate it !!!

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Excel, the issue is more related to Excel DEV. I'll move your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to concatenate multiple records into one

    Hi everybody:
    I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
    Lan|Author
    English|Ernest Hemingway
    Spanish|Octavio Paz
    Spanish|Mario Vargas Llosa
    English|Sinclair Lewis
    Spanish|Gabriel García Márquez
    And I want to get this:
    Author
    Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
    I have worked with SQL Server and I can do something like this:
    CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
    RETURNS varchar(5000) AS
    BEGIN
    declare @retvalue varchar(5000)
    set @retvalue=''
    select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
    return substring(@retvalue,1,len(@retvalue)-1)
    END
    ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
    FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
    v_ret VARCHAR2(4000);
    v_element VARCHAR2(4000);
    v_cursor sys_refcursor;
    BEGIN
    OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
    LOOP
    FETCH v_cursor INTO v_elemento;
    EXIT WHEN v_cursor%NOTFOUND;
    IF v_ret IS NULL THEN
    v_ret := v_element;
    ELSE
    v_ret := v_ret || ', ' || v_element;
    END IF;
    END LOOP;
    RETURN v_ret;
    END;
    Exist some other way to do this?
    Best Regards
    Jack

    Tks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
    I wil read about the other techniques than Hoek mention
    Best Regards.
    Jack

  • Concatenate multiple records into one single record

    Hello everyone,
    Can anyone guide me how to merge multiple records into one single record
    like......... I am getting the data in the file like
    aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
    ffffff/gggg/hhhhhhhhhhhhhh
    /123/4567/55555/99999999/kaoabfa/eee
    fffff/kkkkkkkk/llllllllllllllllllllllll
    when i use gui_upload I am getting the data into the internal table in the above format.
    My main intension is to split the record at / to multiple lines and dowload it into another file.
    What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.

    Yes, it should work.
    In my example
    Loop at itab.
    concatenate i_text itab into i_text.
    endloop.
    You change that loop for the loop of your internal table with the file records
    So if you have this three records
    'aaaa/bbb/ccc'
    '/dddd/efg'
    'hijk/lmn'
    i_text will look like this at the end
    'aaaa/bbb/ccc/dddd/efghijk/lmn'
    then in this part of the code
    split i_text at '/' into table itab2.
    itab2 will have the records looking like this
    aaaa
    bbb
    ccc
    dddd
    efghijk
    lmn'

  • Concatenate multiple columns into one string

    Hello,
    I am using Oracle 11.2, how can I concatenate the value of multiple columns into one string with one SQL:
    create table testTb(classId number(5), classRoom varchar2(32));
    insert into testTb value(101, 'room101');
    insert into testTb value(101, 'room201');
    insert into testTb value(101, 'room301');
    insert into testTb value(202, 'room444');
    insert into testTb value(202, 'room555');
    I would like to generate the result as followings:
    Class 101 is in room101, room201, room301
    Class 202 is in room444, room555
    Thanks,

    Hi,
    Since you're using Oracle 11.2, you can use the aggregate LISTAGG function:
    SELECT       'Class ' || classid
                   || ' is in '
                 || LISTAGG ( classroom
                         ) WITHIN GROUP (ORDER BY classroom)
                   AS txt
    FROM       testtb
    GROUP BY  classid
    ;The generic name for concatenating all the strings in a group is String Aggregation . This page shows several ways to do it, suitable for different versions of Oracle.

  • Collapsing two tables into one table or one queue

    When you have data that exists in 2 tables A and B and B is essentially a child of A if you want to process these records such that you see all A's before their assoociated B how can you use either Streams or AQ to collapse these two tables into one? The data exists at it's source in database tables it will be replicated to another location and at that location I want to keep the data as it exists at the source but also process it in the ordered fashion I described above. My thinking is to publish the data to one queue but the challenge is to ensure that all A's are put on the queue before their B is. I don't just want a priority queue whereby all A's are processed before B's because if that happens B's will never be processed. but I simply want to avoid reading a B off the queue before I've read it's A.

    No version number and no clarity of what you are trying to accomplish.
    Without knowing that the problem is a nail ... I'd hardly be recommending using a hammer.

  • Concatenate multiple lines into one

    Post Author: [email protected]
    CA Forum: General
    Hi,I'm trying to pull data out of one table that could have multiple lines (indicated by a line count field for each row).  The user wants to see all lines in one field only.  I tried the following but am running into issues if there's only one row (one line count). With this, the single row is concatenated with itself. //@groupheader-initilizewhileprintingrecords;stringvar x:=""//@detailwhileprintingrecords;stringvar x:=x+ //@groupfooterwhileprintingrecords;stringvar x Any ideas appreciated.  Thanks!

    Post Author: Charliy
    CA Forum: General
    Take the initialize formula out of the Group Header.
    Place it an the Report Header, and create a second (print suppressed) Group Footer and place it there

  • Multiple BI Query Results into one Table

    Hi All
    Can I embed Multiple queries into one table using VC?
    I have data in different BI sources(Info Areas) like sales and distribution,Shipments etc. Can I write any universal query to retrive data from multiple sources?(If any???)

    Hi Jan Pasha,
    My model contains two BW queries which uses UNION and sent result to one table.
    I tried using UNION also but when I use it I am able to see no records to select in result table.
    I donot have any coloums in common. Is it pre-requisite for using UNION?

  • Importing 30 tables into one SQL Table (Help Required)

    Dear Experts,
    I am new in SQL server, actually i need to gather 30 different excel file in one sql server table and i have imported all excel file in different databases, all tables have 186 different columns and datatypes. I couldnt change data type while conversion.
    Now all columns have different data type which are occupying extra space in my database.
    Now the problem is that i need to convert all databases into one database or table. Although i have created a table but i dont have idea how to import all table into one table  and defining datatype in new table while importing the old tables.
    Please help me in this matter or if any body has skype or any other chatting id please do let me know so that i may explain it better.
    Thanking you in advance.
    Best Regards,
    SQL_beginner

    There are several things you can try.  If you have SSIS, take a look at this.
    http://www.singhvikash.in/2013/06/ssis-how-to-load-multiple-excel-files.html
    https://www.simple-talk.com/sql/ssis/importing-excel-data-into-sql-server-via-ssis-questions-you-were-too-shy-to-ask/
    Also, if your files have virtually the same name, like files with dates in the name, you can loop through files in your folder, and increment the loop with each run through.
    DECLARE @intFlag
    INT
    SET @intFlag
    = 1
    WHILE (@intFlag
    <=30)
    BEGIN
    PRINT @intFlag
    declare @fullpath1
    varchar(1000)
    select @fullpath1
    = '''\\path to your files\'
    + convert(varchar,
    getdate()- @intFlag
    , 112)
    + '_your-text-file-name.txt'''
    declare @cmd1
    nvarchar(1000)
    select @cmd1
    = 'bulk insert [dbo].[your-table-name] from '
    + @fullpath1 +
    ' with (FIELDTERMINATOR = ''\t'', FIRSTROW = 2, ROWTERMINATOR=''0x0a'')'
    exec (@cmd1)
    SET @intFlag
    = @intFlag + 1
    END
    GO
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Merging (Joining) two tables into one

    Is it possible to merge two adjacent tables into one table in Pages? Also, how can you split one table into multiple tables?

    If we use the exact meaning of the words, the response is no and no.
    If we play a bit with the meanings we may do the trick.
    (1) I create a table with 6 columns and 5 rows.
    (2) select cells D1 …F5, copy, paste in the document but out of the table. We get the right half of the table.
    From the tool bar, reduce the number of columns of table 1 fom 6 to 3. Bingo we have the two halves of the original table.
    (3)Select the first half and increase the number of rows from 5 to 10
    (4) copy the entire second half, select cell D1 in the enlarged table, paste.
    Bingo, we have the merged table.
    For sure, a merge and a split tables features would be welcome but as the table tool is the one used in the spreadsheet, I would be surprised if these features where introduced one day.
    _Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'11
    Yvan KOENIG (VALLAURIS, France) jeudi 22 avril 2010 17:28:48

  • How to fill the data of two different tables into one?

    Hi Experts,
    I have two tables named CDHDR and CDSHW(structure). I have extracted the  data from these two tables through two function modules named CHANGEDDOCUMENT_HEADER and CHANGEDOCUMENT_POSITION. Now I have the data in to different tables.
    These two tables neither has relationship with each other through any field nor have any field which exist in both. Can anyone tell me in this case what should be the process to take the data of both the tables into one table. How can I match the record of one table to another?
    thanks a ton in advance.
    Edited by: Moni Bindal on Apr 28, 2008 4:16 PM
    Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:42 PM

    Hye Bindal,
      without a relation, it is not possible to club the data of 2 internal tables. More over it depends on the requirement as to y u should club to non related quantities in an internal table.
    if you wish to do so, one thing is it has internal table which includes the strucute of the 2.
    data: begin of ty_out,
              first type first_structure,
              second type second_structure,
             end of ty_out.
    data: itab type standard table of ty_out.
    data: wa type ty_out.
    loop into it1 into wa1.
    move corresponding wa to wa1.
    append wa to itab.
    endloop.
    loop into it2 into wa2.
    move corresponding wa to wa2.
    append wa to itab.
    endloop.
    now the internal table itab will have all the contents of it1 and it2.
    <REMOVED BY MODERATOR>
    Thanks,
    Imran.
    Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:43 PM

  • Best approach to join multiple statistics tables into one

    I have read different approaches to join multiple statistics tables into one, they all have a column "productobjectid".
    I want to get all data for each product and put it to excel and output a jpg statistic with cfchart.
    How would you do this, the sql part?
    Thanks.

    A couple suggestions:
    1) when joining tables, its best to list both table/fields that you are joining in the FROM clause:
    FROM shopproductbehaviour_views INNER JOIN shopproductbehaviour_sails ON shopproductbehaviour_views.productobjectid = shopproductbehaviour_sails.productobjectid
    2) You add tables to a SQL join by placing another join statement after the SQL above:
    SELECT *
    FROM TableA INNER JOIN TableB on TableA.myField = TableB.myField
    INNER JOIN TableC on TableA.anotherField = TableC.anotherField
    3) If you have columns in the tables that are named the same, you can use column aliases to change the way they appear in your record set:
    SELECT TableA.datetimecreated 'tablea_create_date', TableB.datetimecreated 'tableb_create_date'
    4) Certainly not a requirement, but you might want to look into using <cfqueryparam> in your where clause:
    WHERE shopproductbehaviour_sails.productobjectid = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#all.productobjectid#">
     You might want to consider checking out one of the many tutorials on SQL available online.  Many of the questions you posed in your post are covered in pretty much every basic SQL tutorial.  Alternately, a good SQL book is worth its weight in gold for a beginning web applications developer.

  • Export multiple tables into one flat file

    I have data in multiple tables on a processing database that I need to move up to a production database. I want to export the data into a flat file, ftp it to the production server and have another job pick up the file and process it. I am looking for
    design suggestions on how to get multiple tables into one flat file using SSIS?
    Thank You.

    Hey,
    Without a bit more detail, as per Russels response, its difficult to give an exact recommendation.
    Essentially, you would first add a data flow task to your control flow.  Create a source per table, then direct the output of each into an union all task.  The output from the union all task would then be directed to a flat file destination.
    Within the union all task you can map the various input columns into the appropriate outputs.
    If the sources are different, it would probably be easiest to add a derived column task in-between the source and the union all, adding columns as appropriate and setting a default value that can be easily identified later (again depending on your requirements).
    Hope that helps,
    Jamie

  • Merge multiple tables into one for export to excel

    I've got a few tables in Numbers, and I've spent ages making them all look the same, then when I exported to an excel file, they split up into seperate tables. How can i merge all these into one table so they can all be viewed in Excel, without losing the cell shading/borders etc?
    I tried just copying/pasting the tables into a new blank table, but this doesn't paste the borders etc...
    Cheers
    Adi

    Adi,
    Fill color will copy and paste, as will Text styles, but borders will not when pasting into another table. My suggestion for future work is to not use fancy borders, or don't apply them until you have combined the tables.
    If you would like Apple to consider changing the behavior of borders during Copy/Paste operations, you can leave Feedback for them under the Numbers Menu.
    Jerry
    Message was edited by: Jerrold Green1

Maybe you are looking for

  • Message Codes in essbase

    Version: Essbase 6.5 and 7.1 I'm trying to parse certain application specific essbase log files (for both versions listed above) to track user activity. Basically I'm just targetting the "Requestor" message code range I'm finding the user logged in b

  • Mass BP creation of category Corp account

    Dear Peers, I have to create mass BP - role "Prospect " from an excel along with the Contact person and the Employee responsible. Do i need to create mass BP-Prospect first and then create mass BP- role "Contact person"? 1. If it is so how to link th

  • Error: Error in OPEN_FORM for document '123456789' in ME9A(print preview)

    Hello Experts, I am encountering an error when I try to print preview my RFQ form via ME9A. What I did was to just copy the existing custom form to my own custom form then assign my form to our output type via NACE transaction. So when I click the di

  • Checkbox click issue

    <script> function onclickFn() { document.all.pre_paid_amount.innerHTML = 'display text'; </script> <input type="checkbox" name="fm_check" value="1" onClick="onclickFn();"> is it possible to click on checkbox and display text...then click again...remo

  • TS1538 my i-phone wont connect to i-tunes i canceled the update by accident, can anyone help?

    my i-phone wont connect to i-tunes i canceled the update by accident, can anyone help?