SUM two fileds from different rows from the same table

I would like to SUM two fileds from different rows from the same table but I don't know how to do that.
E.g.
BillingTransactionsIndex      CreateDate      UserType      UserIndex      TransType      Reference      Total      Balance
2      6/5/2008 15:02      1      51      1      150      -288.2      -288.2
5      6/8/2008 11:55      1      51      1      157      -1.58674      -289.787
In the table above I want SUM fields Total and Balance for the first row and the the next row SUM 2nd row Total with 1st row Balance
Please help
Thanks

SQL> with tbl as
  2  (select 1 as ID,  90 as total from dual
  3          union all
  4  select 2 as ID,  23 as total  from dual
  5          union all
  6  select 3 as ID,  15 as total  from dual
  7          union all
  8  select 4 as ID,  20 as total  from dual)
  9  select id , total, sum(total) over (order by ID) as balance from tbl
10  /
        ID      TOTAL    BALANCE
         1         90         90
         2         23        113
         3         15        128
         4         20        148
SQL>

Similar Messages

  • HOW CAN I CREATE A VIEW FROM SAME TABLE WHERE I NEED COLUMNS DETAILS FROM DIFFERENT ROWS IN THE SAME TABLE

    i have a table1 on the top, but i want to create a view from table 1 as  view mentioned beneath the table 2. Could any of you please help me.
    table1
    ID
    office
    employee
    activity
    1
    246
    -9999
    698
    2
    ##-99
    21480
    698
    3
    104
    -9999
    7025
    4
    ##-99
    88908
    7025
    5
    108
    -9999
    2415
    6
    ##-99
    17135
    2415
    7
    246
    -9999
    698
    8
    ##-99
    21480
    698
    9
    104
    -9999
    7025
    10
    ##-99
    88908
    7025
    11
    108
    -9999
    2415
    12
    ##-99
    17135
    2415
    view
    ID
    office
    ID1
    employee
    activity
    1
    246
    2
    21480
    698
    3
    104
    4
    88908
    7025
    5
    108
    6
    17135
    2415
    7
    246
    8
    21480
    698
    9
    104
    10
    88908
    7025
    11
    108
    12
    17135
    2415

    declare @forumsTable table (ID int, officeID int, employeeID INT, activityID int)
    insert into @forumsTable (ID, officeID, employeeID, activityID)
    values
    (1 ,246, -9999, 698 ),
    (2 ,-99, 21480, 698 ),
    (3 ,104, -9999, 7025),
    (4 ,-99, 88908, 7025),
    (5 ,108, -9999, 2415),
    (6 ,-99, 17135, 2415),
    (7 ,246, -9999, 698 ),
    (8 ,-99, 21480, 698 ),
    (9 ,104, -9999, 7025),
    (10 ,-99, 88908, 7025),
    (11 ,108, -9999, 2415),
    (12 ,-99, 17135, 2415)
    select f1.ID, f1.officeID, f2.ID as ID1, f1.employeeID, f1.activityID
    from @forumsTable f1
    inner join @forumsTable f2
    on f1.activityID = f2.activityID
    and f1.officeID > 0
    and f2.employeeID > 0
    and f1.id - f2.id = -1
    You really need to improve the relationship here.
    Perhaps you could make office and activity an exclusive pair.

  • Data from Different datasources in the same table

    Hi everyone,
    Here I am under this complex problem.
    I have two different Bapi's which are being called multiple times.
    These bapi's have 3 common export parameters. I need to display a table with these 3 common export parameters (columns), as columns and two other custom columns.
    Data in custom colums needs to be filled based on the the 3 original columns with some logic build over these 3 columns.
    All the data returned under these columns is to be accumulated and showed in the frontend in a table.
    Any ideas.. how will you handle this in the context of controllers and UI table.
    Do I need to create a dictionary element?
    Please help..
    Thanks,
    Amber

    Hi Amber,
        In your context, create a value node with 3 value attributes for the BAPI output params with the exact same name as the BAPI params. Then you can use the WDCopyService class to copy the corresponding fields.
        For the two custom columns, create 2 calculated attributes in the same value node. The WD framework will generate setters and getters for these attributes. In the setter method write the logic for calculation of these attributes.
    Regards,
    Satyajit.

  • Hi can someone tell me if it is possible to have two accounts (from different countries) in the same laptop?

    Hi can someone tell me if it is possible to have two accounts (from different countries) in the same laptop?

    Hi...
    The issue is that your credit or debit card credentials must be associated with the same country where you reside to make purchases.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article
    Billing policy is the same for both the iTunes as well as Mac App Stores.

  • Data from different databases in the same report.

    Hi Everyone,
    I am trying to build a reconciliation report in which I need to show the data from the source and target, side by side.
    Source and target are both different databases, although being oracle only
    Whenever a new data model is created, it gets attached to a data source and in the report we need to choose a specific data model.
    Can we have data from different databases in the same report ?

    Yes, it is possible.
    One way Is to use dataTemplates. There you can make queries from any number of different databases (The max I have done is 5).
    It looks something like that:
    <dataTemplate name="NameOfTemplate">
    <dataQuery>
         <sqlStatement name="Q1" dataSourceRef="Connection1">
              <![CDATA[     select * from table1]]>
         </sqlStatement>
         <sqlStatement name="Q2" dataSourceRef="Connection2">
              <![CDATA[     select * from table2]]>
         </sqlStatement>
      </dataQuery>
      <dataStructure>
         <group name="RESULT1" source="Q1">
              <element name="P_FIRST_NAME" value="P_FIRST_NAME"/>
         </group>
         <group name="RESULT2" source="Q2">
              <element name="P_DATE" value="P_DATE"/>     
         </group>
      </dataStructure>
    </dataTemplate>dataStructure is very important when you get data from different places, if you don't define those elements, then only the result from Q1 is shown.
    The second possible way is to make as two different data models, each containing their own query and then set Main Data Set as concatenated SQL Data Source.
    Best of luck,
    Evelyn

  • How to update data in database from different region of the same page

    Hi,
    I have pepared two regions of tabular form based on the same table,each region is selecting different columns of the same table.
    I want to update the values from different regions in the database using single submit button.
    Regards
    Shashi

    I presume that the two regions are working fine with their individual buttons and your issue is how to make them both save with one button.
    Here is how
    a. You will have 2 ApplyMRU and 1 ApplyMRD processes for each of the regions. Right? Lets say you have 2 "Save" (i.e. label=Save) buttons, one has name SUBMIT and the other SAVE ( SUBMIT and SAVE being the requests that will be sent when they are clicked , respectively)
    b. Make the Display condition on one of the buttons 'Never'. Now it won't show when you run the page. Lets say you made SAVE's conditional Display 'Never'
    c. Go and change the condition on all ApplyMRU and ApplyMRD processes from "When Button Pressed" to "Request is contains in Expression1". In Expression1 enter SUBMIT,SAVERegards

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • Mail sorting messages from different people in the same thread?

    I have this weird issue. It's happened before but I figured I might be able to figure this out.
    I got a response from somebody this morning and whats happening is, when I click on his response, the email shows up on the right like it should. However, ths email is from "Floyd" and shows as email "2". It shows another email below it in the "thread" from "Taryn" and has absolutely nothing to do with this email. The only similarities are the subject line which says "Poster". The "First" email from Taryn is from April. It seams as if it's sorting the emails by subject line. I don't want emails from different people in the same thread. Any thoughts on how to fix this issue? Image attached.
    OSX 10.8.4

    This question is about the same as mine.  I migrated all my data from old mac mini to new mac mini.  System screwed up and permission and owners were not setup.  Now I'm trying to salvage this mess.  I'm also trying to import mail, which I think should be on the computer but I don't know where.
    Same question where does the computer store Mail mail?
    Chuck

  • How to sum different column in the same table

    Hi everyone
    I would like to know how can I make the sum of different column in the same table using apex
    exple:
    TR_PROJ_BIL_TRIM.ENTPIDFISC as ENTPIDFISC,
        TR_PROJ_BIL_TRIM.EXEANNEE as EXEANNEE,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV as PROJBILTRIMT1PREV,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV as PROJBILTRIMT2PREV,
        trunc( TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV)+(TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV)
    from TR_PROJ_BIL_TRIM TR_PROJ_BIL_TRIM
    group by TR_PROJ_BIL_TRIM.ENTPIDFISC,TR_PROJ_BIL_TRIM.EXEANNEE
    but while trying to run this script i get this error message:"ORA-00979: not a GROUP BY expression"
    thanks for reading me and I hope to hear from you soon

    Hi,
    Your question do not have anything do with APEX.
    It is pure SQL question and you will get better answer this kind questions from SQL and PL/SQL forum
    You need have GROUP BY when you use aggregate functions like SUM.
    I assume you like just add two columns.
    Try
    SELECT ENTPIDFISC
        ,EXEANNEE
        ,PROJBILTRIMT1PREV
        ,PROJBILTRIMT2PREV
        ,trunc(PROJBILTRIMT1PREV) + (PROJBILTRIMT2PREV)
    FROM TR_PROJ_BIL_TRIM
    Regards,
    Jari

  • Can I sync two ipods with different ID on the same computer?

    can I sync two ipods with different ID on the same computer?

    Hi,
    Yes you can as long as you have two seperate user accounts on your computer. Hope this helps.
    xxmitchxx90

  • Trigger in mutation - Update another rows in the same table with a trigger

    Hi ,
    I try to do a before update trigger on a table , but the trigger is in mutation. I understand why it do that but my question is :
    How can I update other rows in the same table when a UPDATE is made on my table??????
    Here is my trigger :
    CREATE OR REPLACE TRIGGER GDE_COMPS_BRU_5 BEFORE
    UPDATE OF DEPARTEMENT--, DISCIPLINE, DEG_DEMANDE, CE_ETAB
    ON GDEM.COMPOSITION_SUBV
    FOR EACH ROW
    Organisme : FQRNT-FQRSC
    Date de création : 14-07-2011
    Date de modification :
    Modifié par :
    Auteur : Johanne Plamondon
    Description : Ce déclencheur s'executera lors de la modification
    du responsable dans la table COMPOSITION_SUBV
    DECLARE
    V_OSUSER V$SESSION.OSUSER%TYPE;
    V_PROGRAM V$SESSION.PROGRAM%TYPE;
    V_TERMINAL V$SESSION.TERMINAL%TYPE;
    V_MACHINE V$SESSION.MACHINE%TYPE;
    V_MODULE V$SESSION.MODULE%TYPE;
    V_LOGON_TIME V$SESSION.LOGON_TIME%TYPE;
    V_AUDIT_ID NUMBER;
    vSEQ NUMBER;
    i NUMBER;
    vID DEMANDE.ID%TYPE;
    BEGIN
    begin
    SELECT OSUSER, PROGRAM, TERMINAL,MACHINE,MODULE, LOGON_TIME
    INTO V_OSUSER,V_PROGRAM,V_TERMINAL,V_MACHINE,
    V_MODULE,V_LOGON_TIME
    FROM V$SESSION
    WHERE TYPE = 'USER'
    AND USERNAME = USER
    AND LAST_CALL_ET IN (0,1)
    AND ROWNUM < 2;
    exception when others then null; end;
    IF NVL(:NEW.SC_PART,' ') = 'CHC' THEN
    SELECT COUNT(*)
    INTO i
    FROM DEMANDE
    WHERE DEM_REF = :NEW.DEM_ID
    AND PER_NIP = :NEW.PER_NIP;
    IF i = 1 THEN
    SELECT ID
    INTO vID
    FROM DEMANDE
    WHERE DEM_REF = :NEW.DEM_ID
    AND PER_NIP = :NEW.PER_NIP;
    UPDATE COMPOSITION_SUBV
    SET --CE_ETAB     = :NEW.CE_ETAB,
    --DISCIPLINE  = :NEW.DISCIPLINE,
    DEPARTEMENT = :NEW.DEPARTEMENT,
    --DEG_DEMANDE = :NEW.DEG_DEMANDE,
    DATE_MODIF = SYSDATE,
    USER_MODIF = V_OSUSER
    WHERE DEM_ID = vID
    AND PER_NIP = :NEW.PER_NIP
    AND ANNEE = :NEW.ANNEE;
    END IF;
    END IF;
    /*EXCEPTION
    WHEN OTHERS THEN
    NULL;*/
    END;

    A standard disclaimer, the mutating trigger error is telling you that you really, really, really don't want to be doing this. It generally indicates a major data model problem when you find yourself in a situation where the data in one row of a table depends on the data in another row of that same table. In the vast majority of cases, you're far better off fixing the data model than in working around the problem.
    If you are absolutely sure that you cannot fix the data model and must work around the problem, you'll need
    - A package with a collection (or global temporary table) to store the keys that are modified
    - A before statement trigger that initializes the collection
    - A row-level trigger that adds the keys that were updated to the collection
    - An after statement trigger that iterates over the data in the collection and updates whatever rows need to be updated.
    If you're on 11g, this can be simplified somewhat by using a compound trigger with separate before statement, row-level, and after statement sections.
    Obviously, though, this is a substantial increase in complexity over the single trigger you have here. That's one of the reasons that it's generally a bad idea to work around mutating table exceptions.
    Justin

  • Publish two publications from different customers with the same Adobe DPS ID

    Hello:
    I have a publication made on InDesign and I have uploaded it to the Adobe Server with my Adobe DPS account. For the first publication, I published the publication with the Folio Producer on the digitalpublishing portal, and then I created the app using the Adobe Viewer Builder. Then, I tried it locally on my iPad. It was working fine and I could see my publication.
    Now, I do need to upload a new publication for a different customer with the same Adobe DPS account and I need to create a different app with the new customer look and feel but I don't want to show the first publication in this new app, only the last one.
    In a nushell, I need to keep separated two publications (or more) when they are published if I'm using the same DPS Account... Is that possible?
    Saludos Cordiales,

    Hi Leo,
    Every title should have its own publication AdobeID (a title can contain multiple editions / folios).
    So you have to request for every title you want to work on a provisioned account with Adobe. Make sure that you have setup the corresponding emailaddress / emailalias. For example [email protected] and [email protected]
    After the accounts have been provisioned you can:
    * upload and organize multiple folios for that publication in the corresponding Folio Producer
    * Create a viewer with your Viewer Builder and on the first page supply the AdobeID for the give publication
    You can request new publication accounts any time and these are included with your DPS subscription.
    When you first account got provisioned, you should have received an excel document to request provisioning for the various publications. In this document you can list the accounts you want to use for publications, individual users of the system and viewer builder access.
    With kind regards,
    Klaasjan Tukker
    Adobe Systems Benelux

  • SUM two ROWS in the SAME Table

    Hi,
    I have a problem with this issue. I want to sum two rows from the same table, but I don´t know how to do that. I tried to do it with CTE, but always I get the same error "Ambiguous". I would like to ask you, if there is other manner to get that
    data (sum two rows) and if it is possible to see examples about it.
    Thank you  in advance

    Hi Vaibhav,
     I leave you my scrip:
    USE Modelling
    GO
    --TABLE Aer_Lingus_Income_Statement
    IF OBJECT_ID('Aer_Lingus_Income_Statement') IS NOT NULL
    DROP TABLE Aer_Lingus_Income_Statement
    GO
    CREATE TABLE Aer_Lingus_Income_Statement
    ID [nvarchar](255) NOT NULL,
    Name_Account [nvarchar](255) NULL,
    Company [nvarchar](255) NULL,
    Level0_Account [nvarchar](255) NULL,
    Level1_Account [nvarchar](255) NULL,
    Level2_Account [nvarchar](255) NULL,
    Level3_Account [nvarchar](255) NULL,
    Level4_Account [nvarchar](255) NULL,
    Level5_Account [nvarchar](255) NULL,
    Level6_Account [nvarchar](255) NULL,
    Level7_Account [nvarchar](255) NULL,
    Level8_Account [nvarchar](255) NULL,
    Year_2006 decimal (15,2) null,
    Year_2007 decimal (15,2) null,
    Year_2008 decimal (15,2) null,
    Year_2009 decimal (15,2) null,
    Year_2010 decimal (15,2) null,
    Year_2011 decimal (15,2) null,
    Year_2012 decimal (15,2) null,
    Year_2013 decimal (15,2) null,
    GO
    ALTER TABLE Aer_Lingus_Income_Statement
    ADD CONSTRAINT PK_Aer_Lingus_Income_Statement PRIMARY KEY (ID)
    GO
    INSERT INTO Aer_Lingus_Income_Statement
    SELECT *
    FROM Aer_Lingus_data_Income
    IF OBJECT_ID('Aer_Lingus_Income_Statement_Historic') IS NOT NULL
    DROP VIEW Aer_Lingus_Income_Statement_Historic
    GO
    CREATE VIEW Aer_Lingus_Income_Statement_Historic
    as
    Select Level0_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Level0_Account ='Revenue'
    Group by Level0_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account= 'Passenger revenue' and Level0_Account ='Revenue'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account= 'Ancillary revenue' and Level0_Account ='Revenue'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account= 'Other revenue' and Level0_Account ='Revenue'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account= 'Cargo revenue' and Level0_Account ='Revenue'
    Group by Name_Account
    UNION ALL
    Select Level0_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Level0_Account ='Operating expenses'
    Group by Level0_Account
    UNION ALL
    Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Level1_Account ='Staff costs' and Level0_Account ='Operating expenses'
    Group by Level1_Account
    UNION ALL
    Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Level1_Account ='Depreciation, amortisation and impairment' and Level0_Account ='Operating expenses'
    Group by Level1_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Aircraft operating lease costs' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Fuel and oil costs' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Maintenance expenses' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Airport charges' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='En-route charges' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Distribution costs' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Ground operations, catering and other operating costs' and Level0_Account ='Operating expenses'
    Group by Name_Account
    UNION ALL
    Select Level1_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Level1_Account ='Other (gains)/losses - net' and Level0_Account ='Operating expenses'
    Group by Level1_Account
    UNION ALL
    Select Name_Account , sum(Year_2006) as Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    Where Name_Account ='Employee profit share' and Level0_Account ='Operating expenses'
    Group by Name_Account
    GO
    WITH sumasRevenue
    AS (
    SELECT Name_Account, ID
    , sum(Year_2006) AS Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    WHERE Level0_Account = 'Revenue'
    GROUP BY Name_Account, ID
    WITH ROLLUP
    , total
    AS (
    SELECT Y2006,Y2007 ,Y2008,Y2009 ,Y2010 ,Y2011 ,Y2012 ,Y2013
    FROM sumasRevenue
    WHERE Name_Account IS NULL
    sumasOperatingExpensive
    AS (
    SELECT Name_Account, ID
    , sum(Year_2006) AS Y2006, sum (Year_2007) as Y2007, sum (Year_2008) as Y2008, sum (Year_2009) as Y2009, sum (Year_2010) as Y2010,
    sum (Year_2011) as Y2011, sum (Year_2012) as Y2012, sum (Year_2013) as Y2013
    FROM Aer_Lingus_data_Income
    WHERE Level0_Account = 'Operating expenses'
    GROUP BY Name_Account, ID
    WITH ROLLUP
    , total1
    AS (
    SELECT Y2006,Y2007 ,Y2008,Y2009 ,Y2010 ,Y2011 ,Y2012 ,Y2013
    FROM sumasOperatingExpensive
    WHERE Name_Account IS NULL
    SELECT distinct ID , s.Name_Account,
    (s.Y2006* 1.0 - t.Y2006) AS [V2006] ,(s.Y2007* 1.0 -T.Y2007 ) as [V2007] , (s.Y2008* 1.0 /T.Y2008 ) as [V2008],(s.Y2009* 1.0 /T.Y2009 ) as [V2009],
    (s.Y2010* 1.0 /T.Y2010 ) as [V2010],(s.Y2011* 1.0 /T.Y2011 ) as [V2011],(s.Y2012* 1.0 /T.Y2012 ) as [V2012],(s.Y2013* 1.0 /T.Y2013 ) as [V2013]
    FROM sumasRevenue AS s , sumasOperatingExpensive AS t
    Where ID IS NOT NULL
    UNION ALL
    SELECT distinct ID,COALESCE(s.Name_Account,'NON CURRENT ASSETS') AS Name_Account ,
    sum (s.Y2006* 1.0 / t.Y2006) as V2006,sum (s.Y2007* 1.0 / t.Y2007) as V2007,sum (s.Y2008* 1.0/ t.Y2008) as V2008,sum (s.Y2009* 1.0/ t.Y2009) as V2009,sum (s.Y2010* 1.0/ t.Y2010) as V2010,
    sum (s.Y2011* 1.0 / t.Y2011) as V2011,sum (s.Y2012* 1.0/ t.Y2012) as V2012,sum (s.Y2013* 1.0/ t.Y2013) as V2013
    FROM sumasRevenue as s , sumasOperatingExpensive as t
    Where ID IS NULL and Name_Account IS NULL
    GROUP BY Name_Account, ID
    WITH ROLLUP
    select *
    from Aer_Lingus_Income_Statement_Historic
    Thank you in advance

  • How can I align two different text row in the same table in two different way (one centered and the other one on the left)?

    Hi,
    I want to center two different text row that are in the same table but one on the center and the other one on the left. I put a <span> tag hoping that it has been overwhelmed the table's class properties The .bottomsel's font-family and the .Cig84's font-family and colour work but the text-align don't: they're both on the left.
    These are my source and CSS codes:
    Source:
    <table width="600" border="0">
      <tr>
        <td class="bottomref"><p><span class="bottomsel">| <a href="index.html" target="_self">Main</a> | <a href="about.html" target="_self">About</a> | <a href="clients.html" target="_self">Clients</a> | <a href="contact.html" target="_self">Contact</a> |</span><br />
          <span class="credits">Credits: <span class="Cig84">Cig84</span></span></p></td>
      </tr>
    </table>
    CSS:
    .bottomsel {
      text-align: center;
      font-family: Georgia, "Times New Roman", Times, serif;
    .credits {
      text-align: left;
    .Cig84 {
      color: #F00;
      font-family: "Comic Sans MS", cursive;

    Use paragraph tags with CSS classes.
    CSS:
         .center {text-align:center}
         .left {text-align:left}
    HTML:
    <table width="600" border="0">
      <tr>
        <td class="bottomref">
              <p class="center">This text is center aligned</p>
              <p class="left">This text is left aligned</p>
        </td>
      </tr>
    </table>
    Nancy O.

  • WM-PP : Backflush a material from different bins in the same storage Type

    Hi Gurus,
    We have a business scenarion where we do manual staging for production , the staging area has different bins within the same storage type for the same material, I am wondering if there is a way to backflush the material from different storage bins upon prod. order confirmation (using a control cycle?)
    Thanks
    Kris T

    Look like it's not possible using the SAP standard.

Maybe you are looking for

  • Using a TV as a second monitor

    I'm trying to use a TV as a second monitor (for watching movies) with Windows through Boot Camp (netflix instant play isn't support in Mac yet). When I plug in the mini-DVI adapter with the yellow video cable, my screen goes blank for a moment and co

  • How to create a parameter to allow multiple selection

    Hi, I am developing report in Oracle EBusiness suite. I use concurrent program to develop the report. My question is how to create a parameter to allow multiple selection for such kind of report? thanks Lei

  • Embedding fonts within a postscript file

    Hi all, I want to know the best way to embed specific fonts within a postscript file. More specifically, I have several postscript procedures that will draw shapes, graphs, and make labels based on the user's input. Right now the font is hard-coded,

  • Camera shake filter missing in Photoshop CC

    I have dowloaded the Trial version of Photoshop CC in Spanish and everything is fine with one exception: the camera shake filter option does not appear on the list of options. Has anybody had this problem? If yes, how to solve it? Thank you for your

  • Keeping a mask stationary while moving the object

    Hi all, How do I lock a mask in place while moving the layer it is masking through the mask and out the other side. I find that the mask always wants to emulate the motion of its object, which makes sense. I've been manually deleting the motion path