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.

Tags: Database

Similar Questions

  • 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.
    
  • How can I get the most recent copy of the SAS 70 of EchoSign reports?

    How can I get the most recent copy of the SAS 70 of EchoSign reports?

    Hello Emilyp96102994,

    I recommend to open a ticket with the support that they can provide more detailed information about:

    Support | services of Adobe eSign

    -Usman

  • 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

  • Get the most recent version number of CC Applications

    Hello

    is there a way to get the most recent version of all/some products CC numbers? We want to make a list with the latest versions. On the website of adobe, not found any source, where you can easily get the version numbers of products. The creative Application of cloud is perhaps not the best solution to check versions. This should be done by a script automaticality every week/month. Is there any URL/downloadable file to get the latest versions?

    concerning

    Dominic

    is there a way to get the most recent version of all/some products CC numbers?

    I don't know, location of a resource on the Adobe website that provides this information in one alone.

    The closest I know is to

    2015 all updates of Adobe CC: Direct for Windows download links | ProDesignTools

  • 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

  • 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 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

  • 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
    
  • How to get the difference in dates in days

    Hi friends,

    How to get the date difference between two dates exactly

    date2-date1 days exactly... shouyld rounded to the nearest value of...

    and one entire display i mean positive integer
    Select round ((sysdate) - to_date (date_start)), date_start days of per_periods_of_service

    This gives negative also result

    Hello

    776317 wrote:
    Hi friends,

    How to get the date difference between two dates exactly

    date2-date1 days exactly... shouyld rounded to the nearest value of...

    Date1 - date2 is the exact number of days is after date2 date1. (It is as accurate as possible, given that the DATEs do not have fractions of a second).

    and one entire display i mean positive integer
    Select round ((sysdate) - to_date (date_start)), date_start days of per_periods_of_service

    You want to probably get the exact number of days first, then ROUND this number:

    SELECT  ROUND (SYSDATE - TO_DATE (date_start, ...))   AS days
    FROM    per_periods_of_service; 
    

    Always pass arguments at least 2 to TO_DATE:
    (1) the string to be converted, and
    (2) a saying string how (1) is formatted

    This gives negative also result

    Right; If date1 is before date2 then date1 - date2 returns a negative number.
    If you want to never get a negative value, use ABS (date2 - date1). If it returns 4, then you know that one of the DATEs was 4 days before the other, but you won't know who was earlier.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • How to get the timestamp of data DAQmx Read

    Hello

    I have to read 4 analog channels using DAQmx AI read in LabVIEW 2012. I am using screws DAQmx.

    Acquisition rate is 4000 samples per second, and the number of samples per channel is 200.

    I use only one task DAQmx to read the data. I get 4 data tables for 4 channels each table length is 200, every time, DAQmx Read happens.

    But I want to get the seal of these 200 samples per channel. How to get the seal of these samples, made me know.

    Thank you

    You have not indicated your code. If you choose to read the waveform data, the cluster includes t0 and dt. That's all the information you need.

  • How do you get the most recent backup that always has this app on it?

    My 2 years has removed an application in the course of the past week. He regularly plays with my phone, so I have no idea when he managed to do so. I do iCloud backups every night and have this updated app to make backups as well. Is there a way to check the applications included in backups to restore the most recent backup with this app still on it and I hope that the latest data? The only option I can think of right now is to keep remove and restore my phone until I get to a backup with the application, but this seems incredibly long.

    You can see a breakdown of the contents of the backup of the last backup. If you know that it has been deleted some time in the past week, restore a backup from a week ago. If there was some new data on the phone since then you do not want to lose, then Yes, you would probably try the trial and error method.

Maybe you are looking for

  • Apple have problem

    I now use the new iMac end 5K. Just buy not more than 1 month ago and 1 month my feeling are not really comfort with many problems of crash and others always makes me doubt when I turn on my new iMac, in the hope of not getting other problems again.

  • use of extra recovery disk

    I have mine but never asked for it. What is this for?  I have lost my documents and it says "refer to the printed instructions.  I have a system of SR5410F

  • How to make a progressive beacon search using Windows Photo Gallery

    Photo Gallery tags Is it possible to do a search of progressive beacon in the Gallery?  Meaning: select a tag, and then a second tag IN the first tag.  If this isn't the case, it would be a great feature advanced to consider in the future.

  • Get the GPS Position in a specific interval

    Hi BB-Devs, I m developing a BB10 application where I use the GPS location Services. I need to update my current position in a specific interval. First of all: In the corrugation Simulator, everything works fine. My position will be refreshed every x

  • Scanner Epson Perfection 3590 not recognized on my laptop Dell Inspiron

    The scanner worked perfectly well. But he went off the screen all of a sudden and I'm unable to re - install the scanner in Windows 7 because it does not recognize the scanner. I tried to uninstall all USB host controllers and restarted the computer.