Adding two column data  from two different tables.

Hi, I have two tables i want to add two column with same id and put it in third table
T1 is
id Value
1 50
2 100
3 500
4 75
T2 is
id Value
3 -20
4 80
5 -30
6 -10
I want the out put as
1 50
2 100
3 480
4 155
5 -30
6 -10
i have written
select a.id,a.value+b.value from t1 a,t2 b where a.id=b.id(+)
this is not giving me the id's from t2.

select id, sum(value) from
(Select id,value from t1
union
select id ,value from t2
)group by id;

Similar Messages

  • Getting Data from 2 different table and saving it in the third table

    Hi,
    My question is i have 2 different table where the data is stored. And Nothing is at Level0 and i don't need it.
    Table A will be at Level1, this is a scroll and depending on this value the level2 grid will be populated with the values.
    Say for example Table A is groups; data e.g., Cars, MotorBike etc
    Table B will have the data for Group Cars: Holden, Toyota, Honda etc., MotorBike: Honda, Suzuki, Yamaha etc.,
    Now lets say there are 3 divisions in the company AA , BB
    Division AA has been allocated group Cars only
    Division BB has been Allocated Both Cars and MotorBikes.
    To do this i have used a query view where depending on the Division i choose the group and then i get the required fileds.
    Now my Problem is that i need to save this data in table C but on the ad-hoc basis can't write a query with in the code to do that.
    tried using work record on the scroll but i cant do that as well. Any Suggestions?
    One more thing when the Page open this data should be pre-populated on the page depending on the division, the user will not be able to select anything from the prompt.
    Edited by: 952330 on Aug 12, 2012 8:32 PM

    I hope I can clarify:
    For our purposes here:
    Table 1 = "Step 2 - Product Sizes"
    Table 2 = "Option id Master"
    Table 3 = "Export - Product Info"
    Table 1:
    The user would enter values for "productcode," "Horz," and "Vert"
    "Size" would auto fill based on values in Horiz and Vert (I have this taken care of already).
    Table 2: This is a completely static table that I want to search against. - Data from other tables in the doc does not alter or change the data in this doc.
    We just want to look at table 2. Find the existing value in "table 2 : size" column that matches the "table 1 : size" column  and then pull the "optionids" and "productprice" from that row.
    Can the value from "Table 1 : Size" be used as a search term in "Table 2 : Size?"
    Table 3: The user does not enter any values on this table. 
    "productcode" is pulled from table 1 - "Table 1 :: A5" = "Table 3 :: A5"
    "optionids" and "productprice" are pulled from Table 2 columns "D" and "E" - however we do not know which Table 2 row it is pulling from until we enter data in Table 1.
    As I'm writing this I'm realizing that
    A. this is probably really confusing to you.
    B. this may be impossible inside of numbers.
    If you have some other method that would facilitate the same out come but be structured differently please let me know.
    --- maybe to help you understand further what I am doing here is my current workflow:
    I record the size of a piece of art.
    Then I manually go to my "Option id Master" and find the same size.
    I then copy the corresponding "optionids" and "productprice" cells. (these options control the prices displayed on my website)
    I got to my "Export - Product Info" table and paste the values in the corresponding cells.
    I was hoping to automate this as it takes a long time when you have hundreds of products.
    Thanks for the help!

  • Query to pull data from 2 different tables

    Hi so currently I am using VS2008 and am using a DNN module to pull information based on a specific Article on our website. On the home page I am currently displaying the Title, Summary, Date and Author of the article. Currently under our feature Stories section of the site http://prepsonthenet.com/dnn/Home/tabid/386/Default.aspx the Title, Summary and Date, Author are being displayed for the top 8 articles that contain images. I was able to combine the 'Author' and Article table to display the 'AuthorName' for the first 8 images. That code is below:
    strQueryArticleFirst.Append("select top 4 ArticleID,Title,Summary,[Text],");
    strQueryArticleFirst.Append("(SELECT NAME FROM AUTHOR AU WHERE AU.AUTHORID = Article.AUTHORID) AS AUTHORNAME, ");
    strQueryArticleFirst.Append("Convert(varchar(50),date,110)as [Date] from article");
    strQueryArticleFirst.Append(" WHERE CategoryID=27 AND State='WI' AND deleted is null ");
    Within this we have a strQueryArticleSecond which displays the next 6 stories without images: http://prepsonthenet.com/dnn/Home/tabid/386/Default.aspx
    The code is a bit different here though and I can't seem to figure out how to link this back up to grab the 'AuthorName'
    strQueryArticleSecond.Append("SELECT * FROM(");
    strQueryArticleSecond.Append("select top 4 * from( ");
    strQueryArticleSecond.Append("select top 8 * from article ");
    strQueryArticleSecond.Append("where CategoryID=27 AND State='WI' and deleted is null ");
    I get what the strQueryArticleSecond and how it is grabbing all the fields that were used in strQueryArticleFirst. I am just wondering how to re-link the AuthorName is this strQueryArticleSecond. Any help is appreciated. Thanks!

    Sarangan,
    Is there a way to get these data in a single
    select query.Yes, use the "union" operator. See the "Oracle SQL Reference" for more details. It is available from here:
    http://tahiti.oracle.com
    Good Luck,
    Avi.

  • External Content Type (BCS) with a dropdown column choices from a different table

    I want to create an ECT with Create/Update method using SPD.
    The dropdown choices should be also from another table in the database.
    How can I achieve this?
    ----------------------- Sharepoint Newbie

    Hi,
    It is not supported to create External Content Type with a dropdown column by OOTB. 
    For a workaround, you can use Custom Field Controls and jQuery to add
    Drop Down List to External List Form.
    Please take a look at this article
    SP 2010: Customizing the forms for External Lists (BCS) in SharePoint 2010 by using Custom Field Controls and jQuery
    Reference:
    https://social.technet.microsoft.com/Forums/office/en-US/61ffb8a0-af16-4104-94f9-255ea1b8bdf0/dropdown-from-external-content-type?forum=sharepointcustomizationprevious
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Selecting data from two different tables.

    Do we need to use join two tables with primary/foreign key while trying to use select statement for getting data from those to table.? If no who can i go about do it.

    872959 wrote:
    If i am using From clause to get data from two different tables, is it necessary that both tables have column of identical data in them.In general, they ought to (or you need to join in a third table that tells you how to map rows from one table to rows of the other table).
    It is not strictly necessary that there be any join condition between tables. If you don't provide a join condition, Oracle has to do a Cartesian product. That means that if there are n rows in one table and m rows in the other, the result set will have n * m rows. It is very rarely a good idea to write queries that do Cartesian products but it does occasionally happen.
    Justin

  • Cartesian of data from two tables with no matching columns

    Hello,
    I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
    I am thinking about something like:
    for $COUNTRY in ns0: COUNTRY ()
    for $PROD in ns1:PROD()
    return <Results>
         <COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
         <PROD> {fn:data($PROD/PROD_NAME)} </PROD>
    </Results>
    And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
    What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
    What I’ve noticed also is that when I add something like:
    where COUNTRY_NAME != PROD_NAME
    everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
    So the question is – what’s the suggested approach for such queries?
    Thanks,
    Leszek
    Edited by xnts at 11/19/2007 10:54 AM

    Which in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
    Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
    If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so.

  • Is it possible to show data from two different sql tables?

    Is it possible to show data from two different sql tables? Either to show combined data by using a join on a foreign key or showing a typical master detail view?
    I have one table With data about a house, and another table With URL's to images in the blob. Could these two be combined in the same Gallery?
    Best regards Terje F - Norway

    Hi Terje,
    If you have a unique key, you could use one of the following functions for your scenarios:
    If you only have one image per house, you can use LookUp:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745501
    If you have multiple images per house, you can use Filter:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745487
    Thanks
    Robin

  • 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

  • AWM dimension mapping - is it possible to load data from two input tables ?

    Hello All
    I have two tables ProductFamily (parent level) and Products (child level).
    I want to load a dimension from these two tables where the parent-child relationships are maintained (I am using AWM).
    I created a mapping with these two tables as input, but the data loaded does not maintain the relationships.
    So how do I do that? Is it possible to load dimensions where different levels get data from multiple tables?
    Is there any type of joiner available in AWM?
    thanks
    Few Notes:
    - I do not want to use OWB here as my data is clean
    - In AWM, When I loaded the data from a single view which contained data from both input tables, it worked fine. But this is my worst case option.

    You should use the Snowflake Dimension option in the Dimension mapping screen for the Product Dimension (as opposed to the default dimension mapping style - star schema).
    This will modify the mapping inputs to include a separate parent level key for each hierarchy/level i.e. for each hierarchy/level (unless topmost level of hierarchy), you need to specify the parent level key in addition to the current level key, code/name/description/other attributes etc.
    You can do the mapping in either .... use icons at the top of the mapping screen.
    the drag/drop mode by dragging the relational column onto dimension model - hierarchy/level/attribute
    -or-
    the table expression mapping mode which gives the same effect.. dragging a column onto an attribute sets the expression in <schema>.<table>.<column> format.
    HTH
    Shankar
    Note1: Complete the mapping in one go.. Switching b/w the mapping modes cause the mappings to be reset.
    Note2: Assume your data is correct, foreign key to parent level table: ProductFamily exists in child level table: Products.

  • APEX Application accessing data from two different databases

    Hi All,
    Currently as we all know that APEX Application resides in database and is connected to the schema of that database.
    I want APEX Application to be running and accessing data from two different databases. Elaborating my question,
    Currently, my APEX Production Application is connected with XXXX Schema of DB1 Database(Where APEX Resides). Now I want to add some pages into this APEX Application for REPORT Purpose, But I want to connect this REPORT APEX Pages to get data from Different Schema YYYY for Database DB2.
    Is it possible to configure this scenario?
    The reason for doing this is to avoid the REPORT related (adhoc queries) resource utilization effect on Production DB1 Database.
    Thanks
    Nil

    1. If you do the joining of two or more tables in DB1 then all data is pulled over to DB1 and then the join is executed: so more data over the databaselink and more work for DB1. Better keep the joining stuff where the data resides and just pull exactly that data over that you need.
    2. Don't know about your different block sizes. Seems a nice question for one of the other forums (DBA or SQL).
    3. I mean create synonyms on DB1 for reports VIEWS in DB2.
    Hope all is clear!

  • Selecting data from two tables

    I am trying to select data from two tables.  The only problem that I am running into, is that i am only seeing results from my 'uploads' table.  there is also a record in documents where user = 1 that should show up.  here is my sql:
    $userIDNum = 1;
    $sql="Select *
    from uploads, documents
    WHERE uploads.user = documents.user AND uploads.user = $userIDNum
    ORDER BY uploads.title ASC, documents.title ASC";

    You'll need to explain a little more about your data and what you are trying to accomplish. Your current sql will select all columns from both the uploads and documents tables but only rows where the user id in both tables match, AND the user id equals 1. Is that not what you are seeing? Where's the code that outputs the results?

  • Can we get the data from two internal tables in ALV.

    hi friends i would like to display the data using two internal tables using alv grid.please guide me.

    Hi,
    ALV would be having a specific layout say :
    MATNR
    MAKTX
    QTY
    Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
    If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
    Best regards,
    Prashant

  • Working with data from two separate tables

    In a report I'm building, I have two tables: "Registration" and "SpecialDates".
    In the Registration table has client info specific to an account number. Each account number has a different billing cycle.. either Cycle 1, Cycle 2, or Cycle 3.  This is listed for the account number as {Registration.Cyle}. In the SpecialDates table I have three different dates listed for each cycle. So this table looks something like this:
    fldCycle          fldPastDueDate
    1                     01/11/2010
    2                     12/15/2009
    3                     1/20/2010
    The problem I'm having is I can't link {SpecialDates.fldCycle} to {Registration.Cycle}.  I have to somehow make the date from the SpecialDates table show up on the report depending on the value of {Registration.Cycle}.  Does anyone have any ideas on how to do this?
    Edited by: MarcieHennessy on Jan 27, 2010 7:26 PM

    Then I would create a custom table with the Add Command in Data Expert with the following query:
    SELECT Field1, Field2, Field3, cast (fldCycle as char(10)) as fldCycle, Field4, Field5, etc
    FROM SPECIALDATES
    Where you list all the fields from the table you will need in the report, with the link field converted to a string.  Then replace the SPECIALDATES table in your linking with the new custom table .  Now when you link from REGISTRATION to the new custom table.
    Fuskie
    Who notes you can rename the custom table to a more recognizable name...

  • Extracting cost center data from two tables

    Hi Everyone,
    I'm trying to extract cost center data from two different tables in SAP and pull it into one InfoObject.  I'm using 0costcenter and it's already extracting data from one of the tables I need.  Could someone explain how to add the second table? Thank you.

    You can create a Generic Extractor , Create a view on 2 tables with proper join condition n use this to load 0COSTCENTER.

  • SSAS Tabular - Merge data from two tables to one

    Hi,
    I have two ReportServer databases in two different instances of SQL Server. I want to extract the ExecutionLog3 data to a Tabular model. Now, I have two separate tables in Tabular with duplicated measures but I want to have the data from two ReportServer in
    the same table.
    Any idea?
    Regards.

    Hi Numero4,
    According to your description, there are two Reporting Services databases, and you want to merge the data in a tabular model, right? 
    As per my understanding, you can create a link server on one of the server, and then merge the data in database lever other than in tabular mode. In this case, import the merged data into the tabular model. Here are some useful links for you reference.
    http://msdn.microsoft.com/en-IN/library/ff772782.aspx
    http://support.flexquarters.com/esupport/index.php?/Default/Knowledgebase/Article/View/2458/52/how-to-create-link-server-with-ms-sql-200520082012-64-bit-using-qodbcqremote
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • My verticle Spry menu will not work in Internet Explorer

    I know a lot of people have posted about similar issues, and I've researched multiple "solutions" on multiple forums for something that will work, but nothing has solved the problem so far. Here is a link to the prototype homepage: http://www.abrasiv

  • Two finger scrolling quit working on Windows 7 Boot Camp.

    My two finger scrolling just quit working while running Windows 7 on Boot Camp. Any ideas?

  • How do you make list of songs to buy in iTunes using AppleScript?

    I'm trying to write an AppleScript program to create a list of songs that the user doesn't currently own. The idea is that my script would load a playlist from somewhere, then let the user listen to samples and buy some or all of the songs. This woul

  • Problem in searching the document

    Hi Experts, We've uploaded a ppt file into our KM repository. Similarly we've uploaded some other files (txt, doc, etc..) at the same location. But the problem here is, when we are searching the ppt document with search option the document (ppt) is n

  • New problem conflicting item

    Dear nokia ye kya majak bna rakha hai. I update my nokia browser on c2-03.and it shows conflicting item.nokia express.what is this have u provide nokia for free.then why create such problem.