How to find the most recent date prev?

Hello

Here is the sample table and sample data.
CREATE TABLE t1 (code NUMBER, dt DATE, price NUMBER)
/
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/21/2012', 'MM/DD/YYYY'), 10);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/22/2012', 'MM/DD/YYYY'), 10);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/23/2012', 'MM/DD/YYYY'), 12);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/24/2012', 'MM/DD/YYYY'), 9);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/25/2012', 'MM/DD/YYYY'), 8);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/26/2012', 'MM/DD/YYYY'), 13);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/27/2012', 'MM/DD/YYYY'), 11);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/28/2012', 'MM/DD/YYYY'), 15);
Insert into T1 (CODE, DT, PRICE) Values (2, TO_DATE('10/29/2012', 'MM/DD/YYYY'), 15);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/30/2012', 'MM/DD/YYYY'), 13);
Insert into T1 (CODE, DT, PRICE) Values (1, TO_DATE('10/31/2012', 'MM/DD/YYYY'), 13);
COMMIT;
I have to read the table so that I got when I read a line of CODE = 1 for DT = 30 - OCT - 2012, I have to check what was the price for the CODE = 1 in the most recent previous date (which is October 28, 2013). Then I will compare the two prices (for 30 Oct 28th) and fill out another table.

I hope I have described the situation well.

Could someone help me with this please?

My actual table contains a few million lines in DEV env and a lot more in PROD.

Thanks in advance!

If you use the analytical function LAG you can 'Watch' data of previous lines...

SQL> ed
Wrote file afiedt.buf

  1  select code, dt, price
  2        ,lag(price) over (partition by code order by dt) as prev_price
  3* from t1
SQL> /

      CODE DT                        PRICE PREV_PRICE
---------- -------------------- ---------- ----------
         1 21-OCT-2012 00:00:00         10
         1 22-OCT-2012 00:00:00         10         10
         1 23-OCT-2012 00:00:00         12         10
         1 24-OCT-2012 00:00:00          9         12
         1 25-OCT-2012 00:00:00          8          9
         1 26-OCT-2012 00:00:00         13          8
         1 27-OCT-2012 00:00:00         11         13
         1 28-OCT-2012 00:00:00         15         11
         1 30-OCT-2012 00:00:00         13         15
         1 31-OCT-2012 00:00:00         13         13
         2 29-OCT-2012 00:00:00         15

11 rows selected.

Tags: Database

Similar Questions

  • How to find the most recent patches autoconfig

    How to find the most recent patches in 11i autoconfig.

    Salvation;

    After you apply the hotfix 9535311, should I run autoconfig or it runs as part of the patch in bleachers apps/db.

    You will need to follow patch Readme Part.

    1.demarrez 2.1 before you apply this Patch
    2. that follow 2.2 How to apply this Patch
    3 2.3 after you apply this hotfix

    All stages of coverage in him read me part

    Respect of
    HELIOS

  • How to find the most recent record?

    How to find the most recent record?

    Hello

    It is part of our Bill the elements table, retrieved by the following query:

    SELECT movimento, dt_movimento, cd_material,
    cd_tp_operacao, nf, series,
    sole, pr_unitario
    Of itemfat
    WHERE cd_material IN ('722136', '759177', ' 810725', 818848')
    AND cd_tp_operacao ("' 1102 c ' ', ' 2102 C")
    ORDER BY cd_material,
    dt_movimento


    MOVIMENTO DT_MOVIMENTO CD_MATERIAL CD_TP_OPERACAO NF SERIES AS PR_UNITARIO
    2008-03-11 2137625, 722136 2102 1084738 3 120 2 915
    2588890 08/05/2008 722136-2102 1090987 3 120 2,5615
    755522 09/10/2007 759177-2102 101449 1 200 0.6
    701055 03/10/2007 810725-2102 1013865 1 36 10.9
    1588804 20/12/2007 810725 2102 1014182 1 96 10.9
    1305653 03/12/2007 818848-2102 108555 1 240 6.5
    3102134 07/18/2008 818848 2102 109784 1 360 6.5


    Seems that I whant to retrieve only the most recent records for each item, as:

    MOVIMENTO DT_MOVIMENTO CD_MATERIAL CD_TP_OPERACAO NF SERIES AS PR_UNITARIO
    2588890 08/05/2008 722136-2102 1090987 3 120 2,5615
    755522 09/10/2007 759177-2102 101449 1 200 0.6
    1588804 20/12/2007 810725 2102 1014182 1 96 10.9
    3102134 07/18/2008 818848 2102 109784 1 360 6.5


    Can someone help me with a sentece SQL to do?

    Thanks in advance.

    You can certainly do it:

    SELECT   movimento, dt_movimento, cd_material, cd_tp_operacao, nf, serie,
             quantidade, pr_unitario
        FROM itemfat i
       WHERE cd_material IN ('722136', '759177', '810725', '818848')
         AND cd_tp_operacao IN ('1102C', '2102C')
         AND dt_movimento =
                (SELECT MAX (dt_movimento)
                   FROM itemfat d
                  WHERE d.cd_material = i.cd_material
                    AND d.cd_material IN ('722136', '759177', '810725', '818848')
                    AND d.cd_tp_operacao IN ('1102C', '2102C'))
    ORDER BY cd_material, dt_movimento
    

    : p

  • How to find the most recently read or access files or documents.

    In XP, there is a choice of the icon when you open start botton for the most recently viewed or read files.  Once again, I would like this feature.  How?

    Currently, I click on start, then the documents, and the only choice which is "recently changed". This choice is usually useless for me.  Thank you

    Windows, which fell in the start menu because now you can pin programs to the start menu and programs have separate to show their recent files in the same kind of drop-down menu, then it has become redundant.

    In the same start menu list watch the privacy section and check the two options and apply.

    Once these programs are on the list of the start menu, make a right click and select PIN to start menu, all recent item will be on this list and can be pinned to this list.

    You can also drag and pin programs to the taskbar as well.

    Also if you want an option to see recently changed items, open your library and on the top of the left column is changed recently listed, click with the right button on this list, select send to and click on create the shortcut on the desktop, once on your desktop you can drag to your taskbar or just leave it there change the display of this page and the dates of changes will be listed.

  • Lightroom did not find most recent backup how to find the most recent backup.

    Lightroom could not find my most recent catalog. so I told him to use the default catalog. Now I can't find the record of my last backup or my most recent photos. I use Mac 10.11.1 El captain. I used his Spot Light search with no results. I went to the mac images where I kept my backups with no result.

    Any help would be greatly appreciated.

    you want to use spotlight to search for. LRCAT not. IRCAT

  • How to get the values based on the most recent date

    Oracle Version 8i



    How to get the new_value based on the most recent date

    SELECT max (MODIFIED_ON), the Group LOG_ITEM_CHARACTERISTICS by MODIFIED_ON new_value - does not

    Please, someone help me
    CREATE TABLE LOG_ITEM_CHARACTERISTICS
    (
      CHAR_LOG_ID          NUMBER(10)               NOT NULL,
      PIRM_ID              VARCHAR2(8)              NOT NULL,
      CONSTANT_FLAG        VARCHAR2(1),
      CHARACTERISTIC_NAME  VARCHAR2(25)             NOT NULL,
      TYPE_NAME            VARCHAR2(10)             NOT NULL,
      NEW_VALUE            VARCHAR2(3000),
      UOM                  VARCHAR2(10),
      MODIFIED_BY          VARCHAR2(30),
      MODIFIED_ON          DATE
    )
    
    SET DEFINE OFF;
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187376, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '1', 'AMPS', 'EMPXD88', TO_DATE('10/25/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187377, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMPXD88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187378, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '0', 'AMPS', 'EMDXB88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187384, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '2', 'AMPS', 'EMAXC29', TO_DATE('11/10/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187385, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55.1', 'VOLTS', 'EMAXC29', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_ON)
     Values
       (2400742, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (574093, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (574094, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131486, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131487, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '16-12-04', 'DD/MM/YY', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131488, '0307490N', 'Y', 'POWER SUPPLY', 'PS2030/WVL', 'ESSENTIAL', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131489, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759086, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759087, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759088, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '14/11/07', 'DD/MM/YY', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646012, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646013, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646014, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646015, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646016, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646057, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646058, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646059, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648577, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648578, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648579, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648580, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648581, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648634, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648635, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;

    user4587979 wrote:
    Hi Frank

    Yes, but I had more than 2 tables with item_characteristics, type_characteristics

    If there are other tables involved, then CREATE TABLE and INSERT statements for them (for the relevant columns only). You must not post a lot of examples of data; usually just a couple of lines per table is enough to show the problem.
    Also post the results desired from these data.

    What I try to do is, I'm comparing new_value in log_item_characteristics (whichever is most recent) with CHR_VALUE in the item_characteristics and the needs of different output values

    I am trying to query is not giving desired out put

    Point out some places where the output is wrong and explain how you get good results in these places, using specific examples from the data sample.

    select  lic.PIRM_ID, ic.CHR_ID, lic.CHARACTERISTIC_NAME,
    lic.TYPE_NAME, ic.CHR_VALUE, lic.NEW_VALUE,  lic.MODIFIED_BY,  lic.MODIFIED_ON,
    ic.CREATED_BY, ic.CREATED_ON,ic.MODIFIED_BY, ic.MODIFIED_ON
    from log_item_characteristics lic, item_characteristics ic,type_characteristics tc  where
    lic.TYPE_NAME=tc.TYPE_NAME
    and lic.CHARACTERISTIC_NAME=tc.CHR_NAME
    and lic.PIRM_ID=ic.PIRM_ID
    and tc.CHR_ID=ic.CHR_ID and ic.CHR_VALUE <> lic.NEW_VALUE
    and lic.pirm_id in ('0307490N','0307521C')
    order by lic.pirm_id
    

    Thank you; It is useful to see the existing query. Really, you have to format your code.

    Please can you help me

    What you've posted so far is like saying "I'm going 200 meters to the North, and then 500 meters East, but I'm not getting where I want to go." I would have a better chance to help you if you said, 'I'm out of my house, at 100, Elm Street and try to get to the supermarket at Broadway 279. I'm going 200 meters to the North... ', or, even better. "I want to buy a newspaper and some orange juice, so I thought I'd go to a convenience store. I start at my house, at 100, Elm Street... »
    Always post some examples of data (CREATE TABLE and INSERT statements, as you did in your first post) and the desired results from these data. Explain how you get these results from these data.

  • I need to know how to remove the most recent version of Firefox. I JUST downloaded tonight and my computer does not have this edit bar little to work with, so I can download the reader good Adobe and my internet was screwed up ever since I downlo

    I need to know how to remove the most recent version of Firefox. I JUST downloaded tonight and my computer does not have this edit bar little to work with, so I can download the reader good Adobe and my internet was screwed up, since I downloaded the new version of Firefox. I want just the old version of this back because I can't download the Adobe stuff which is necessary to protect my computer against hackers apparently not. It would have been nice to know he had a problem with the new update of Firefox BEFORE I downloaded it. I have Vista, which is usually a problem with Adobe and Firefox. I don't seem to be able to run a lot of Adobe at all on my computer because of the Vista.

    This has happened

    Each time Firefox opened

    http://support.Mozilla.com/en-us/KB/installing+a+previous+version+of+Firefox

  • The most recent data in a table view

    I'm adding values to a bulletin board as in the example, but I want to be the most recent data for the user to see the top line.

    He keeps adding to the bottom, and then the user will have to Diecut down see all data.      Can I select the most recent data somehow or get auto-scrolling data table are applied?     I tried registers to shift as well, but no luck.

    Here's my VI

    Thank you

    Mike

    Have you read the help of the function insert in the table? He clearly says that if you leave the unwired index entries, it will insert at the end. So, don't let the unwired index entries. Wire a '0' to the row index.

  • Backup utility Windows 7 application ' are you sure you want to remove the most recent data from the backup file "even if I'm trying to remove the backup set is not the most recent.

    I'm trying to reduce the amount of space that my Windows 7 backup uses so I've come to the place in Windows 7 backup:
    Manage space > view backups...

    I am then presented a list of three backup sets:
    01/03/2012 to 01/04/2012
    12/07/2011 to 12/21/2011
    23/11/2011 to 30/11/2011

    I would like to remove the older two, leaving the most recent. However, this doesn't seem to work as expected. If I try to delete one of the two most recent ones (the first two in the list above) I get the following warning "Are you sure you want to delete this backup file.

    However, if I try to delete the last one in the list, I get a slightly different error "Are you sure you want to remove the most recent data of the file backup?"-sounds strange because it is clearly not the most recent backup according to the dates it's show.

    Of course, I can go ahead and ignore the warnings, but I fear that maybe there are some files in the last backup the value in the list that may not be right more recent set backs.

    In 2011, I thought this might be something wrong with the date formats vs US UK (I am in England so the above dates are in dd/mm/yyyy format and not in jj/mm/aaaa) - but now it's 2012 and I backup from 2012 and 2011 games and he always seems to think that the oldest backup of 2011 is the most recent.

    Any ideas? Can I delete the oldest backup sets (that is, the two that are from 2011) safely?

    Any help much appreciated - thank you.

    Simon

    Update: I checked on other PCs in the office and the situation is the same - is not only something strange on a PC.

  • The most recent date in the report filter.

    Hello

    I have a report with a date column. I would like to run the report for the most recent date. I want to add a filter to the report that retrieves data for the latest in date. What would be the best method to use in the filter. Please notify. Thank you.

    You must first determine what the column that contains the dates on which you want to filter. Say so you have a Date of treatment column containing dates transactions are processed.

    (1) add this column in your workspace.

    2) click this column filter button, and then click Advanced Options > convert this filter in SQL.

    (3) after the name of the column, enter MAX (date_column). So you will have:

    "Table name". " "Date column ' = MAX ("Table name". ("' Date column")

    Now the chances are that you will have a lot of reports who need the "latest date" filter. Therefore, you should really do is built that filter in the repository and expose it as a filter registered for all to use.

  • Select the most recent DATE for identification.

    Hi all

    I need to SELECT records with the most recent DATE for each code. A DATE range is part of the selection criteria.

    My data.
    MY_ID MY_DATE
    1684662 26 JANUARY 09
    1424097 27 JANUARY 09
    1684663 27 JANUARY 09
    1684664 27 JANUARY 09
    1684672 28 JANUARY 09
    0689073 28 JANUARY 09
    1052476 21 JANUARY 09
    1052476 21 JANUARY 09
    1360828 23 JANUARY 09
    1684661 23 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09
    1052476 30 JANUARY 09

    The code below works fine when you select 1 ID in the subselect, but with several ID he always selects rownum = 1 (of course). As far my mind takes me.
    SELECT my_id,
    my_date
    Of
    (SELECT my_id,
    my_date
    FROM my_table
    ORDER BY DESC my_date
    )
    WHERE rownum = 1
    AND * {color: #ff0000} my_id = 1052476 {color} *.
    AND TO_CHAR(my_date,'YYYY/MM/DD') BETWEEN ' 01 / 01/2009 ' AND '' 2009/01/31;

    If I could somehow pass the ID SELECT in the subselect WHERE clause I should have done this.

    Any suggestions?

    Thanks in advance for your help,

    Lou

    One of the many soultions possible.

    ME_XE?with data as
      2  (
      3     select 1684662 as id, to_date('26-JAN-09','dd-mon-yyyy') as the_date from dual union all
      4     select 1424097 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      5     select 1684663 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      6     select 1684664 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      7     select 1684672 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      8     select 0689073 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      9     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
     10     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
     11     select 1360828 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
     12     select 1684661 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
     13     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     14     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     15     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
     16     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual
     17  )
     18  select id, the_date
     19  from
     20  (
     21     select id, the_date, max(the_date) over (partition by id) as max_the_date
     22     from data
     23  )
     24  where the_date = max_the_date;
    
                    ID THE_DATE
    ------------------ --------------------------
                689073 28-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1360828 23-JAN-0009 12 00:00
               1424097 27-JAN-0009 12 00:00
               1684661 23-JAN-0009 12 00:00
               1684662 26-JAN-0009 12 00:00
               1684663 27-JAN-0009 12 00:00
               1684664 27-JAN-0009 12 00:00
    
                    ID THE_DATE
    ------------------ --------------------------
               1684672 28-JAN-0009 12 00:00
    
    12 rows selected.
    
    Elapsed: 00:00:00.03
    
  • Need help get data with the most recent date of entry into

    Hey guys;

    I need help with fine tuning a query to get the one with the most recent implementation.

    Here's my current query:

    /**********************************************
    Select sge.seal_group_id,
    SGE.equipment_id,
    SGE.effective_date
    of seal_group_equipment EMS.
    seal_group sg
    where equipment_id = 48801
    AND EMS. SEAL_GROUP_ID = SG. SEAL_GROUP_ID
    and sge.end_date is null
    Group of sge.equipment_id, sge.seal_group_id, sge.effective_date
    After having sge.effective_date = max (sge.effective_date)

    ******************************************************/

    Which produces the following results:
    SEAL_GROUP_ID - EQUIPMENT_ID - EFFECTIVE_DATE
    25-48801 - 01/01/1993-00: 00:00
    11730-48801 - 22/08/2003 08:42:11


    What I really need, is to show only the line with the most recent date of entry into
    I hope someone can help
    Thank you

    MAX will not work because the SEAL_GROUP_ID could depart. I would say analytical:

    select seal_group_id,
    equipment_id,
    effective_date
    from (
    select sge.seal_group_id,
    sge.equipment_id,
    sge.effective_date,
    RANK() over (partition by equipment_id order by effective_date desc) r
    from seal_group_equipment sge,
    seal_group sg
    where equipment_id = 48801
    AND SGE.SEAL_GROUP_ID = SG.SEAL_GROUP_ID
    and sge.end_date is null)
    where r = 1;
    

    Keep in mind if two records have the same effective_date, they would both appear.

    Note: query above has not been tested, since there is no script provided.

  • How to find the last update date, time and user of the file field peoplecode

    How to find the last updated date time fields of peoplecode records?

    Thank you.

    We can check the update date-time using the following query

    SELECT LASTUPDDTTM IN THE PSPCMPROG WHERE OBJECTVALUE1 LIKE "RECNAME" AND OBJECTVALUE2 AS "FIELDNAME".

  • How to find the difference in date in years, months and days

    Hello
    I need to find the difference between 2 dates in the following way "years months days". "
    Please can help me, how can I achieve this.

    for example, in the scott schema emp table, I need to find the difference in date between sysdate and hiredate for an employee in the following way.

    12 years 7 months 4 days.

    Hello

    Please, see this post to AskTom [difference between 2 dates | http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:96012348060]. There is good information in this forum, for example you can also see this thread [calculation of years, months & days | http://forums.oracle.com/forums/thread.jspa?messageID=3115216�]

    Kind regards

    Published by: Walter Fernández on November 30, 2008 08:58 - adding another link

  • How to find the number of data items in a file written with the ArryToFile function?

    I wrote a table of number in 2 groups of columns in a file using LabWindows/CVI ArrayToFile... Now, if I want to read the file with the FileToArray function so how do I know the number of items in the file. during the time of writing, I know how many elements array to write. But assume that I want the file to be read at a later time, then how to find the number of items in the file, so that I can read the exact number and present it. Thank you all

    Hello

    I start with the second question:

    bytes_read = ReadLine (file_handle, line_buffer, maximum_bytes);

    the second argument is the buffer to store the characters read, so it's an array of characters; It must be large enough to hold maximum_bytes the value NULL, if char [maximum_butes + 1]

    So, obviously the number of lines in your text tiles can be determined in a loop:

    Open the file

    lines = 0;

    While (ReadLine () > 0)

    {

    lines ++;

    }

    Close the file

Maybe you are looking for