Find the stock quantity of the previous year with another way...

Hello
I have a table with the following structure:
create table stock_qties_items
(subinv varchar2(10),item_code varchar2(10),period_name varchar2(5), qty_a number(5,2), qty_b number(5,2));
alter table stock_qties_items
add constraint stock_qties_items_pk primary key(subinv,item_code,period_name);
and some data...
insert into stock_qties_items
values('01','410010010','01-08',10.50,0);
insert into stock_qties_items
values('01','410010010','02-08',19.30,10.35);
insert into stock_qties_items
values('01','410010010','03-08',3,0);
insert into stock_qties_items
values('02','410010010','03-08',8.54,1.90);
insert into stock_qties_items
values('03','410010010','03-08',120.45,1.25);
insert into stock_qties_items
values('03','410010010','04-08',502.10,6.50);
insert into stock_qties_items
values('03','410010010','05-08',5.05,6.20);
insert into stock_qties_items
values('03','410010010','08-08',19.35,65.90);
insert into stock_qties_items
values('02','410010010','10-08',40.85,5.20);
insert into stock_qties_items
values('03','410010010','12-08',75.20,90.15);
insert into stock_qties_items
values('02','410010020','12-08',60.55,0.85);
insert into stock_qties_items
values('01','410010020','07-08',100.90,10.05);
insert into stock_qties_items
values('01','410010010','01-09',8.95,0.05);
insert into stock_qties_items
values('02','410010010','01-09',88.95,100.05);
insert into stock_qties_items
values('03','410010020','01-09',91.05,0.05);
insert into stock_qties_items
values('04','410010020','01-09',11.75,10.05);
insert into stock_qties_items
values('04','410010010','03-09',1.75,110.40);
insert into stock_qties_items
values('04','410010010','05-09',0.75,10.40);
insert into stock_qties_items
values('04','410010025','03-09',1.75,90.00);
insert into stock_qties_items
values('04','410010025','07-09',51.75,190.00);
insert into stock_qties_items
values('04','410010010','09-09',62.15,10.05);
insert into stock_qties_items
values('04','410010010','10-09',39.15,0);
The goal is to find the stock for the current year and previous year. I have accomplished with the following...
select period_year,
           item_code,
           sqi1 stock_prev_year,
           sum(stock_curr_year) stock_curr_year
    from
    (
    select  to_char(to_date(substr(period_name,4,2),'RRRR'),'RRRR') period_year,
         item_code,
      (select sum(qty_a+qty_b)
              from stock_qties_items sq
              where sq.item_code=sqi.item_code
             and to_char(to_date(to_number(substr(sqi.period_name,4,2)-1),'RRRR'),'RRRR')=
                    to_char(to_date(substr(sq.period_name,4,2),'RRRR'),'RRRR')
         ) sqi1,
         qty_a+qty_b stock_curr_year
     from stock_qties_items sqi
     )
     group by period_year,
           item_code,
           sqi1
which generates the following output...
PERIOD_YEAR ITEM_CODE  STOCK_PREV_YEAR STOCK_CURR_YEAR
----------- ---------- --------------- ---------------
2008        410010020                           172,35
2009        410010010           991,79          432,65
2008        410010010                           991,79
2009        410010025                            333,5
2009        410010020           172,35           112,9
Y at - it another way to achieve the same result, given that this table has a few million records and in this request a few other tables parameter should be added...?

Note: I use Db 10 g v.2
Thank you
SIM

Using the LAG function:

SQL> with t as (
  2  select to_char(to_date(substr(period_name,4,2),'RRRR'),'RRRR') period_year,
  3  ITEM_CODE, sum(qty_a+qty_b) STOCK
  4  from stock_qties_items
  5  group by to_char(to_date(substr(period_name,4,2),'RRRR'),'RRRR'), ITEM_CODE
  6  )
  7  select period_year, ITEM_CODE,
  8  lag(stock) over (partition by ITEM_CODE order by period_year) stock_prev_year,
  9  stock stock_curr_year
 10  from t
 11  order by item_code, period_year;

PERI ITEM_CODE  STOCK_PREV_YEAR STOCK_CURR_YEAR
---- ---------- --------------- ---------------
2008 410010010                           991,79
2009 410010010           991,79          432,65
2008 410010020                           172,35
2009 410010020           172,35           112,9
2009 410010025                            333,5

Max
[My Italian oracle Blog | http://oracleitalia.wordpress.com/2010/01/30/compilazione-condizionale-in-plsql/]

Tags: Database

Similar Questions

  • Sales of the previous year with the guest of the current year

    Hello

    I have the year and sales in the criteria and my year is receiving messages. When I select the current year, my report must return data for the current year and previous year and if I select the previous year in the command prompt report should indicate the previous year and before yr previous data.  Could you help us meet this goal.

    Thanks for your help. I was able to do with the variable of presentation... My intention was not to change anything in the RPD. My time dimension is something not clear.

    I just used below the formula to this YEAR being my PV.

    FILTER ("Operation". "Unit price" USING ((cast ("Temps de la Transaction".))) " ((Year of operation"AS INTEGER)) = @{YEAR} {2014}))

    FILTER ("Operation". "Unit price" USING ((cast ("Temps de la Transaction".))) " ((Year of operation"AS INTEGER)) = @{YEAR} - 1))

  • Find the previous quarter

    Hello
    I'm looking for a function that will help me find the previous quarter, then the format base quarter is YYYY | » Q'|| Q.
    For example, when quater_base = 2011Q 1, I need the function returns quarter_previous = 2010Q 4.

    I think I need to convert YYYY | » Q'|| Q on a date and then subtract from 91 days or use add months, but I need help conversion YYYY | » Q'|| Q for a date.
    Thank you very much in advance for your help.
    TERI

    Hi, Teri,

    Welcome to the forum!

    user13426561 wrote:
    Hello
    I'm looking for a function that will help me find the previous quarter, then the format base quarter is YYYY | » Q'|| Q.
    For example, when quater_base = 2011Q 1, I need the function returns quarter_previous = 2010Q 4.

    I think I need to convert YYYY | » Q'|| Q on a date and then subtract 91 days or use add months,.

    Q1 is normally 90 days long. If you subtract 91 days March 1, you return of the last two quarters.
    Q2 is always long for 92 days. If you subtract 91 days from May 31, you have not changed shifts.
    Better use ADD_MONTHS.

    but I need help conversion YYYY | » Q'|| Q for a date.

    If s is a string of 6 characters such as '2011 Q 1' (i.e. Q1 2011), then

    ADD_MONTHS ( TRUNC ( TO_DATE ( SUBSTR (s, 1, 4)
                        , 'YYYY'
                        )
                 , 'YEAR'
                 )
            , 3 * ( TO_NUMBER (SUBSTR (s, 6, 1))
               - 1
               )
            )
    

    is the start DATE of this quarter.
    Subtract 3 months ago, and convert it to a string such as "2010 Q 4":

    TO_CHAR ( ADD_MONTHS ( TRUNC ( TO_DATE ( SUBSTR (s, 1, 4)
                               , 'YYYY'
                               )
                        , 'YEAR'
                        )
                   , 3 * ( TO_NUMBER (SUBSTR (s, 6, 1))
                      - 2     -- NOTE: subtracting 2, to get previous quarter
                      )
                     )
         , 'YYYY"Q"Q'
         )
    

    These strings come Is it possible that you could change the strings to have a month ('01', '04', '07' or 10') instead of the district, or to include both? This work would be much simpler!

    It's a shame that you can't use 'Q' in TO_DATE.
    You might consider a user-defined function to perform the conversion above. It will make your code much cleaner, but it will be slower.

    Thank you very much in advance for your help.
    TERI

    Published by: Frank Kulash, January 4, 2011 18:30
    Corrected the two expressions

  • bougth a second hand iPhone 6 how find the previous owner using the serial number?

    I bought a second hand iPhone 6 and he holds a lock to iCloud how to find the previous of this iPhone owner so that I can email him?

    I don't have a serial number of the phone how to use it so that I can follow the former owner?

    Unfortunately, you can not. Take it to where you bought it for a refund.

    See you soon

    Pete

  • Calculate days a year in the current year/CDA days in the previous year and store in Variables to repository

    Hello peers - how can we calculate CDA days in the current year, CDA days in the previous year using SQL Timestampadd/Timestampdiff works and store them as variables to repository? Appreciate any inputs.

    Thank you.

    Regarding the answer to your other question (How to use the functions Timestampadd/Timestampdiff in the repository Variables) you don't need to use timestampadd / timestampdiff for a block init but real SQL, to verify the features in charge of your database.

    PS: Days CDA? If you just want to know the day number based on the year?

  • Is there a way to get the first Pro CS6 with still now I can't find the previous, offered versions with the subscription of the CC 2015?

    Is there a way to get the first Pro CS6 with still now I can't find the previous, offered versions with the subscription of the CC 2015? What is recommended for creating DVDs with interactive menus?

    Instructions again, cloud or version https://forums.adobe.com/thread/1992717 serial number
    -a of notes on different versions of cloud and step by step on these differences
    -contains information about the separate library download which is necessary
    -CS6 is the last reminder, see here #8 why http://forums.adobe.com/thread/1337952?tstart=0

    Still and 10 Windows https://forums.adobe.com/thread/2015461 use the compatibility mode of Windows 8
    problem/solution to install Encore CS6 https://forums.adobe.com/thread/1934087

  • How to complete the data or details of the only this year and the previous year for the given RATNG?

    Hi all

    I created a form with 5 blocks (namely ENQACMHDR, ENQACMDTL, ENQACEHDR, ENQACEDTL, ENQACSPEC), where I have 8 push buttons (namely ENTER_QUERY, EXEC_QUERY, CLEAR, FIRST, NEXT, PREVIOUS, LAST, and EXIT).

    This form is created just for display purposes only. So after that I ran, all blocks have been blocked against insert and update.

    I have question on 2 fields 'ENQNO' and "RATNG" (both belong to the ENQACMDTL block).

    When I click on "EXEC_QUERY" directly, all data for all years fills.

    But the user wanted the data to be populated only this year and the previous year.

    Yes, on ' Clause WHERE' of the property_palette of the 'ENQACMDTL' block , I put in the following condition:

    SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYY') OR SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (SYSDATE, 'YYYY')

    PROPERTY PALETTE (ENQACMDTL block)
    WHERE ClauseSUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYY') OR SUBSTR (ENQACMDTL. ENQNO, 1, 4) = TO_CHAR (SYSDATE, 'YYYY')


    Data only this year and the year before are now filled. Its ok with the field of "ENQNO".

    The problem is when I have queries on the field "RATNG. 'RATNG' is a Text_item with number of displayed items = 5. (5 lines)


    Here are the 2 columns in a Table (name = ENQACMDTL) in the database.


    ENQNO RATNG
    2013900054500KC2
    2013900047800KC4
    2013520018750KC6
    ...............
    20129000371000KC2
    2012520109500KC2
    2012140019750KC6
    ..................
    2011540036500KC2
    20111000301000KC2
    ..................
    .................
    200610000790KD8
    2006750014750KC6
    2006900072500KC2

    The first 4 issues of "ENQNO" represents the year. There is more than a lakhs of records.

    So, when I have queries on the field "RATNG."

    Example: for RATNG = 500KC2;

    I click on ENTER_QUERY, the field of "RATNG", I put in the 500KC2 of the value and click on EXEC_QUERY; Details regarding the 500KC2 is displayed as well as all the other junk RATNG as 750KC6, 1000KC2 (which belongs to the ENQNO of the current year and previous year) also gets displayed.

    I want details of only RATNG (500KC2) to display, but only for the current year and the previous year, it is 2013900054, 2012520109 (ENQNO).

    Other than 500KC2 RATNG, no other RATNG must be displayed.

    500KC2 = RATNG is also present for ENQNO = 2011540036, 2006900072. But I don't want them to view.

    I want only the data or details of the current year and the previous year to be filled or displayed for the given RATNG.

    Can you help me or tell me what I do for this?

    Hope I'm clear with my question!

    If my question is not clear, let me know please.

    Thank you.

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

    Oracle forms 6i.

    1. check null values in the enqacmdtl.enqno, if so treat them properly.

    2. check the result of select to_char (add_months (sysdate,-12), 'YYYY') prev_year curr_year of double to_char(sysdate,'YYYY')

    3. change the place where clause "year" in the value of numAriques.

    where to_number (substr (enqacmdtl.enqno, 1, 4)) > = to_number (to_char (add_months (sysdate,-12), 'YYYY'))

    Then let me know the result.

  • With the help of SQL, need to display the previous year, current year and the year next to single variable

    Hi all

    We have an obligation to state the previous year, current year and values of the year next as a LOV in the ADF page.

    This is the query that retrieves the previous year, current year and next year. But the result of this query displays values in 3 columns:

    Select (Extract(year from sysdate)-1), extract (year sysdate), (extract (year sysdate) + 1) twice;

    Output:

    2012 2013 2014


    But I want to display them in a single with 3 rows as column:

    2012

    2013

    2014


    Please your ideas.

    or in the same way

    SELECT EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, 12 *(LEVEL-2)))

    OF the double

    connect by level<>

  • Query to find the previous activity in STM

    I have a data base to reflect a State of Transition (STM) Machine. It contains 3 tables: activity, node, and Transition.

    Tables of knots and Transition are the configuration of the STM. They define the different possible States and the possible transitions between States.

    The way that I take through the STM is recorded in the activity Table. A record is created for each visited node.

    I need a query that uses the id of my current activity to find my previous activity, i.e. the activity that precedes me directly. The following rules apply:
    -My Id is meaningless
    -It should work for different configurations of the transition and the node tables, but:
    -The starting node is always the node "A".
    -There is no recursive transition, for example ('B', 'B');
    -There is no circular transitions, for example ('B', 'C') and ('C', 'B')
    -Transition and node tables will never change between the creation of the first activity and the execution of the query.
    -The path reflected in the activity table is always a valid path.
    -My current activity is always the last activity.

    For all data below, find the previous activity of activity with id = 4. The correct answer is "C".
    DROP TABLE Transition;
    DROP TABLE Activity;
    DROP TABLE Node;
    
    CREATE TABLE Node
    (
         Id VARCHAR2(1) PRIMARY KEY
    );
    
    CREATE TABLE Activity
    (
         Id Number(8,0) PRIMARY KEY,
         Node_Id VARCHAR2(1)
    );
    
    CREATE TABLE Transition
    (
         FromNode_Id VARCHAR2(1),
         ToNode_Id VARCHAR2(1)
    );
    
    ALTER TABLE Activity
    ADD FOREIGN KEY
    (Node_Id) REFERENCES Node(Id);
    
    ALTER TABLE Transition
    ADD FOREIGN KEY
    (FromNode_Id) REFERENCES Node(Id);
    
    ALTER TABLE Transition
    ADD FOREIGN KEY
    (ToNode_Id) REFERENCES Node(Id);
    
    INSERT INTO Node VALUES ('A');
    INSERT INTO Node VALUES ('B');
    INSERT INTO Node VALUES ('C');
    INSERT INTO Node VALUES ('D');
    
    INSERT INTO Transition VALUES ('A','B');
    INSERT INTO Transition VALUES ('B','C');
    INSERT INTO Transition VALUES ('B','D');
    INSERT INTO Transition VALUES ('C','D');
    
    INSERT INTO Activity VALUES (1,'A');
    INSERT INTO Activity VALUES (2,'B');
    INSERT INTO Activity VALUES (3,'C');
    INSERT INTO Activity VALUES (4,'D');
    Desired output:
    ID
    -
    C

    Hello

    Assuming that all Activity_id tells us nothing on the way, but all lines of activity together to form a single path, we can get results this way:

    WITH     all_paths    AS
    (
         SELECT     'A' || SYS_CONNECT_BY_PATH (a.Node_id, '/')
                  || '/'     AS node_id_path
         FROM     Transition  t
         JOIN     Activity    a  ON  a.Node_Id  = t.ToNode_Id
         WHERE     LEVEL             = (
                                SELECT  COUNT (*)
                             FROM     activity
                             ) - 1
         START WITH  t.FromNode_Id  = 'A'
         CONNECT BY  t.FromNode_Id  = PRIOR t.ToNode_Id
    )
    SELECT       REGEXP_SUBSTR ( node_id_path
                     , '([^/]+)/' || (
                                        SELECT  Node_Id
                                 FROM    activity
                                 WHERE   Id     = 4  -- target_id
                                    )
                             || '/'
                   , 1
                   , 1
                   , NULL
                   , 1
                   )     AS prev_id
    FROM       all_paths
    ;
    

    This means, there is some character (I used "/" above) that we know never appears in Activity.Node_Id.

    Since there are no loops in Transition, it cannot be more than 1 way that involves all activity lines. If there are N lines in operation, this full path will be one that extends to LEVEL = N - 1. (It is not N, N - 1, because the join between the activity and the Transition will always leave 1 line in activity with Node_Id = 'A'). As soon as we have the full path (which is node_id_path in 1 row, produced by all_paths), we just need to guess what was the Node_Id, which corresponds to the id of the target (4 in this example) and find the previous of the delimited node_id_path node_id.

  • SQL to get % increase in the amount of the previous year

    Version 11g

    Hello

    I have a requirement where I need to calculate the percent increase of wages and costs compared to the previous year,

    If the output should be something like
    Year        Salary       %increase                Rent         %Increase
    
    2012       1000          1000%                   100                     1000%
    2011       100             100%                    10                      100%(depending on last year value)
    2010    . . . 
    .
    .
    .
    The inclusion of scripts are
    create table sal
    (exp_type   varchar2(100),
    exp_date  date,
    exp_amt number);
    
    
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-JUN-11','DD-MON-RR'),685);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-JUN-11','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-JUL-11','DD-MON-RR'),685);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-JUL-11','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-AUG-11','DD-MON-RR'),687);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-AUG-11','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-SEP-11','DD-MON-RR'),687);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-SEP-11','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-OCT-11','DD-MON-RR'),750);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-OCT-11','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-NOV-11','DD-MON-RR'),750);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-NOV-11','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-DEC-11','DD-MON-RR'),755);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-DEC-11','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-JAN-12','DD-MON-RR'),755);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-JAN-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-FEB-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-FEB-12','DD-MON-RR'),750);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-MAR-12','DD-MON-RR'),766);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-MAR-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-JUN-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-JUN-12','DD-MON-RR'),740);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('02-JUL-12','DD-MON-RR'),735);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('02-JUL-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-AUG-12','DD-MON-RR'),739);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-AUG-12','DD-MON-RR'),93.4);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('02-SEP-12','DD-MON-RR'),740);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('02-SEP-12','DD-MON-RR'),93.4);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-APR-12','DD-MON-RR'),570);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-APR-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-MAY-12','DD-MON-RR'),740);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-MAY-12','DD-MON-RR'),89.04);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-NOV-12','DD-MON-RR'),845);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-NOV-12','DD-MON-RR'),93.4);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-OCT-12','DD-MON-RR'),900);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-OCT-12','DD-MON-RR'),93.4);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-FEB-10','DD-MON-RR'),508);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-FEB-10','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('03-MAR-10','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('03-MAR-10','DD-MON-RR'),500);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-APR-10','DD-MON-RR'),509);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('04-APR-10','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Rent',to_date('01-MAY-10','DD-MON-RR'),84.89);
    Insert into SAL (EXP_TYPE,EXP_DATE,"EXP_AMT") values ('Salary',to_date('01-MAY-10','DD-MON-RR'),514.46);
    Any suggestions on how we can calculate the increase in % at run time?


    Thank you
    Ryan

    Hello

    ryansun wrote:
    Thank you Al, Frank!

    I am struggling with the math a bit part. Or maybe % increase is not the correct term. So what I want is the increase in rent and wages in terms of % over the previous year. Thus, for example the output below.

    The salary in 2012 is 8280
    The salary in 2011 is 4999

    so 8280-4999 = 3281

    3281 is 65.6% of 4999.

    The increase last year was 65.6% compared to the last years value while the output of two sqls 165,6%

    Right, Al and I assumed you wanted the percent of last year, not the percentages of increase... Subtract 100 if you want the percentage increase.

  • Get the date of the previous year

    Hi all

    How can I recover date from the previous year, based on today's date, if I have a data type 'date '.

    Marwim wrote:
    Hello BluShadow,

    You should know better ;-)

    select date '2004-02-29' - interval '1' year from dual;
    
    ORA-01839: date not valid for month specified
    

    Well, today he works.

    Concerning
    Marcus

    Edited by: Marwim the 13.10.2011 17:06

    Ah, good point. Really, it's oracle who should know better. It should do the same thing as:

    select add_months(date '2004-02-29',-12) from dual;
    
  • How can I find the music marked with an exclamation point in my itunes library?

    How can I find the music marked with an exclamation point in my itunes library?

    Hello there rdgernnr!

    I certainly don't want to find the songs that show the "!" and get them to play correctly. If you have not yet done it, read this article: If you see an exclamation point next to your items in iTunes - Apple Support

    More precisely:

    Correct the path of the media file

    Follow these steps to help find the correct location of the file iTunes media:

    1. In iTunes on your Mac or PC, select the song, album, movie, or television show that has the exclamation next to him.
    2. In the MenuBar at the top of your screen, computer or at the top of the iTunes window choose Edition > read the information.
      If you are using Windows and you don't see the menu bar, Learn how to turn it on.
    3. When you see a message asking if you want to locate the file, click search.
      • If you know the location of the file, point to it iTunes and try to read your content.
      • If you do not know the location of the file, search for it:
        Mac: Press ⌘ and space control your keyboard, and then type the name of the movie title, app, song, album or artist.
        Windows: Press the Windows on your keyboard, and then type the name of the movie title, app, song, album or artist. If your keyboard does not have a Windows key, press the Escape (Esc) and control (Ctrl) on your keyboard.
      • If the file is on a network drive or external, plug on the volume of disk or external network.
      • If you find your objects in the trash or recycle bin, restore them to their previous location:
        Mac: Control-click or right-click on the item and choose put back.
        Windows: Right-click on the item and choose restore.
    4. Once you retrieve the file, use Get new Info to locate the file, and then point iTunes to the correct location.

    See you soon!

  • Lightroom works only with reduced funktionality. Develop module is not available.  Adobe can not find the license associated with my Adobe why identification code? Every month I pay an amount for PS and LR...

    After the upgrade to Windows 10 Lightroom works only with reduced funktionality. Develop module is not available.  Adobe can not find the license associated with my Adobe why identification code? I bought the license more than 1 year ago. Every month I pay an amount for PS and LR, and for the past 4 months I can't work. Russian support team cannot solve this problem and sent me here.

    Thank you! I reset my password, the problem was in it.

  • Qosmio X 500 - 10W - can I replace the HARD drive with another?

    Hello

    I have a Qosmio X 500 - 10W with two drive HARD Toshiba MK5055GSX 500 GB 5400 RPM 8 MB? SATA II but is one of the hs so I'm wondering if I can be replaced by a more powerful style, drive HARD 750 GB 7200 RPM / min 16 MB Toshiba courses?

    Thank you

    Hey,.

    Your question is a bit hard to understand, but I think you want to replace the HARD drive with another (faster) model, right?

    Well, that s no problem. 7200 RPM hard drives works, they are a little stronger, but they're faster so if you need more performance without problem.
    750 GB or more are also no problem because the SATA interface is not the limited capacity. Theoretically 1 TB or more should also work.

    Anyway, you can buy the 750Go you mentioned that it will work. :)
    ?

  • find the previous owner info (icloud)

    Hi, how can I find the name and surname of the previous owner of my second hand iphone?

    I have the apple ID, but find my iphone is on and I do not know password!

    Thank you

    You can't get from Apple or anyone here. You must contact the former owner, either through the person, you bought the phone you can not. Confidentiality issues prohibit Apple or the cellular carrier to release any of this information. If the person you bought isn't the former owner, then there is the possibility that the unit you have purchased has been stolen.

Maybe you are looking for

  • T500 - how to change discrete ATI graphics card?

    I can't work on how to spend my (ok my wife!) T500 to use the ATI graphics card. Everything I read says do a right click on the battery icon, and then select "maximum performance" or words to that effect. So I did. Then what? It is still using the In

  • Can I have 2 routers in my house and extend my range by buying a second device?

    Hello I have the router 4 X in my living room, but I got a break in the attic on the second floor. The Wifi signal does not reach the attic. I have a Powerline (internet through electricity network) in the attic. I want to wireless internet in the at

  • Code cam USB HDweb 39 on XP3

    Problem 3 different webcams HD manufacturers give a code 39 on normal webcam XP sp3 Device Manager (7 years)) working on the old and new software... five technicians of 'support' from the suppliers of the web cams and other renowned companies accept

  • ID of Windows related

    BACKGROUND HP laptop (HP TouchSmart tm2 Notebook PC) running Windows 7 Pro. I had update problems to Win 10 (couldn't see black screen) then I did a restore using the image I created before the upgrade. I also use a fingerprint reader to access my co

  • Extract xml

    Hi allIt comes to my table structure,create table xml_test (col1 XMLTYPE);It comes to my xml. I want to extract this file as xml below< ROOT >NASA < NAME_OF_THE_COMPANY > < / NAME_OF_THE_COMPANY >< DETAILED_DATA_ENTERED VALUE = 'test' >< TYPES_OF_FIN