find a value that is the most

Let's say I have a column with different values, now I want to find a value located most, how is the best way to make this request?
Is the best solution to do this way:
WITH t AS
 (SELECT 'a' AS VALUE  FROM Dual  UNION ALL
  SELECT 'b'  FROM Dual  UNION ALL
  SELECT 'a' FROM Dual)
SELECT VALUE
FROM (SELECT t.Value, COUNT(*) AS Cnt
           FROM t
           GROUP BY t.Value
           ORDER BY Cnt DESC
          )
WHERE Rownum = 1
As you can see that the value 'a' is more time in table T, then the query must exit the 'a' and nothing more. If the number of occurrences of the 'a' and 'b' would be the same, then the application should exit one of them, no matter which.
As you can see query now does not seem to be well optimized, I think.
(Oracle 10g)

Or

SQL> with t
     as (
  select 'a' as value from dual union all
  select 'b' from dual union all
  select 'b' from dual
)
--
--
select max (value) keep (dense_rank last order by count (*)) value,
       count(*) cnt
  from t
group by value
/
VALUE        CNT
----- ----------
b              2
1 row selected.

Published by: MichaelS on December 14, 2010 10:39

CNT added.

Tags: Database

Similar Questions

  • Value that has the most instances

    Hello

    I have a column and I want to know what values the most occurrences.
    Oracle 10g.

    Columna

    CAT
    DOG
    DOG
    HORSE

    I would like to know it is DOG the value that appears most often.

    Thank you

    If you want only a single value, even if there is a tie, try:

    SQL> WITH a AS
      2  (SELECT 'CAT' AS animal FROM DUAL
      3   UNION ALL
      4   SELECT 'DOG' FROM DUAL
      5   UNION ALL
      6   SELECT 'DOG' FROM DUAL
      7   UNION ALL
      8   SELECT 'HORSE' FROM DUAL)
      9  select max(animal) keep (dense_rank last order by count(*)) animal
     10  from   a
     11  group by animal;
    
    ANIMA
    -----
    DOG
    

    Nicolas.

  • Mr President, how can I enter two rows at the same time with different default values that only the first line to use see?

    Mr President.

    My worm jdev is 12.2.1

    How to enter two rows at the same time with different default values that only the first line to use see?

    Suppose I have a table with four fields as below

    "DEBIT" VARCHAR2(7) , 
      "DRNAME" VARCHAR2(50),
      "CREDIT" VARCHAR2(7) , 
      "CRNAME" VARCHAR2(50),
    

    Now I want that when I click on a button (create an insert) to create the first line with the default values below

    firstrow.png

    So if I click on the button and then validate the second row with different values is also inserted on commit.

    The value of the second row are like the picture below

    tworows.png

    But the second row should be invisible. It could be achieved by adding vc in the vo.

    The difficult part in my question is therefore, to add the second row with the new default values.

    Because I already added default values in the first row.

    Now how to add second time default values.

    Concerning

    Mr President

    I change the code given by expensive Sameh Nassar and get my results.

    Thanks once again dear Sameh Nassar .

    My code to get my goal is

    First line of code is

        protected void doDML(int operation, TransactionEvent e) {    
    
            if(operation != DML_DELETE)
                 {
                     setAmount(getPurqty().multiply(getUnitpurprice()));
                 } 
    
            if (operation == DML_INSERT )
                       {
                               System.out.println("I am in Insert with vid= " + getVid());
                           insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE",
                            (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                           }
    
            if(operation == DML_UPDATE)
                              {                                                    
    
                                 System.out.println("I am in Update with vid= " + getVid());
                             updateSecondRowInDatabase(getVid(),
                                 (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                              }                      
    
            super.doDML(operation, e);
        }
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " +
                 "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')";  
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }
                  }  
    
                  private void updateSecondRowInDatabase(Object value1, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "update vdet set  AMOUNT='"+ value5+"' where VID='" + value1 + "'";                     
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
    
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }                  
    
                  }
    

    Second line code is inside a bean method

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");
                   RowSetIterator rsi = dciter.getRowSetIterator();
                   Row lastRow = rsi.last();
                   int lastRowIndex = rsi.getRangeIndexOf(lastRow);
                   Row newRow = rsi.createRow();
                   newRow.setNewRowState(Row.STATUS_NEW);
                   rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
                   rsi.setCurrentRow(newRow);
    
                   BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");
                   RowSetIterator rsi1 = dciter1.getRowSetIterator();
                   Row lastRow1 = rsi1.last();
                   int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);
                   Row newRow1 = rsi1.createRow();
                   newRow1.setNewRowState(Row.STATUS_NEW);
                   rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);
                   rsi1.setCurrentRow(newRow1);
        }
    

    And final saveUpdate method is

        public void saveUpdateButton(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry();      
    
                   OperationBinding commit = bindingsBC.getOperationBinding("Commit");
                   commit.execute(); 
    
            OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
            operationBinding.execute();
            DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef.
            iter.getViewObject().executeQuery();  
    
        }
    

    Thanks for all the cooperation to obtain the desired results.

    Concerning

  • To find a value that does not move to columns

    Version of database 11g (11.2.0.3.0)
    AIX OPERATING SYSTEM

    I'm writing some SQL/PLSQL, who selects a value in a table that is not always in the same column. I need to find which column is on a table, then use this place of the column to find its value coresponding on another table.

    Example:
    CREATE TABLE TIMES (RUN_ID  NUMBER(10),TIME1 NUMBER(10), TIME2 NUMBER(10), TIME3 NUMBER(10), TIME4 NUMBER(10),TIME5 NUMBER(10));
    CREATE TABLE VALS (RUN_ID  NUMBER(10),VAL1 NUMBER(10), VAL2 NUMBER(10), VAL3 NUMBER(10), VAL4 NUMBER(10),VAL5 NUMBER(10));
    
    INSERT INTO TIMES VALUES (1000, 1,2,3,4,5);                          
    INSERT INTO TIMES VALUES (1001, 2,3,4,5,6);                          
    INSERT INTO TIMES VALUES (1002, 3,4,5,6,7);                          
    
    INSERT INTO VALS VALUES (1000, 101,102,103,104,105);                          
    INSERT INTO VALS VALUES (1001, 106,107,108,109,110);                          
    INSERT INTO VALS VALUES (1002, 111,112,113,114,115);                          
    
    SQL> select * from times;
    
        RUN_ID      TIME1      TIME2      TIME3      TIME4      TIME5
    ---------- ---------- ---------- ---------- ---------- ----------
          1000          1          2          3          4          5
          1001          2          3          4          5          6
          1002          3          4          5          6          7
    
    SQL> 
    select * from vals; 
    
        RUN_ID       VAL1       VAL2       VAL3       VAL4       VAL5
    ---------- ---------- ---------- ---------- ---------- ----------
          1000        101        102        103        104        105
          1001        106        107        108        109        110
          1002        111        112        113        114        115
    So for a time-say 3, I want to be able to find first the rows and columns, it appears in on the TIME table and the upward gaze of the WALTZ in the same places of the column in the table VALS.

    Thus, for example the time 3 above, I want to be able to return:

    1000 103 RUN_ID
    1001 107 RUN_ID
    111 1002 RUN_ID

    I got a database that stores values like that so I can't change the way the data is unfortunately inspired. Is there one clever way to do other than look at each TIME column by Union them together, then creating some dynamic sql statements to get the values of the VALS table?

    This is a simplified example, but the table has 98 columns!

    Any help will be greatly appreciated.

    Published by: 991224 on March 1st, 2013 07:13

    Hello

    Welcome to the forum!

    Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

    If you cannot permanently normalize the data, then you can normalize it on the fly.
    Here's one way:

    WITH   unpivoted_times     AS
    (
         SELECT     run_id
         ,     col_num
         ,     t_val     -- If wanted
         FROM     times
         UNPIVOT ( t_val
                FOR  col_num IN ( time1  AS  1
                                        , time2  AS  2
                                        , time3  AS  3
                                        , time4  AS  4
                                        , time5  AS  5
                                )
              )
         WHERE     t_val     IN (3)     -- or whatever
    )
    SELECT   v.run_id
    ,      CASE  t.col_num
                WHEN  1  THEN  val1
                WHEN  2  THEN  val2
                WHEN  3  THEN  val3
                WHEN  4  THEN  val4
                WHEN  5  THEN  val5
          END   AS v_val
    FROM      unpivoted_times  t
    JOIN      vals            v  ON  v.run_id  = t.run_id
    ;
    

    If the same number of target may occur more than once on the same line at the time, then the above query generates multiple lines with the same run_id. For example, if we change your data a little examples:

    -- Don't use this row:
    -- INSERT INTO TIMES VALUES (1002, 3,4,5,6,7);
    -- Use this row instead:
    INSERT INTO TIMES VALUES (1002, 3,3,3,6,7);                          
    

    Leave all other sample data, as you have it posted, then the output is:

    `   RUN_ID      V_VAL
    ---------- ----------
          1000        103
          1001        107
          1002        111
          1002        112
          1002        113
    

    If you have 98 (not just 5) columns that need to be compared, then you will need to list all 98 of these columns at the time in the UNPIVOT clause and all 98 of vals in the expression BOX. Sorry; I don't see any way around that. You could write dynamic SQL statements to the parts of code for you.

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

  • selecting a field value, which is the most recent CREATE_DATE

    I have two fields in the table CREATE_DATE (Date) and QUEBEC (varchar). How the value of the field for record with the most recent CREATE_DATE? So, if the table contains the following records

    AS CREATE_DATE
    ABCD ON 20/12/2008
    2008-12-21 DEFH
    2009-01-10 ALINE

    I want to request to return ALINE. I now have a query "select table where rownum = 1 order by desc CREATE_DATE. Is there a better way to do it?

    Thank you
    Ravi

    Select from the table where CREATE_DATE = (SELECT MAX (CREATE_DATE) FROM table)

  • The search in Windows Explorer has stopped working properly - it does not find the files which are there, but will find other files that match the search criteria

    Window 7

    Was working before, but have only allowed a number of updates to Windows that had been blocked for a while.

    For example. Type 'safe' in the search box. It finds files and directories with 'security' in the title, but not the files and directories that I can see are there with 'safe' in the title.

    When I search using the "safe * ' it seems to do exactly the same thing as"safe ".  It does not show only files beginning with 'safe'

    My suggestion was not ' safe * ' but ' name of the file: ~ safe * "(without the quotes).

  • I want to download Lightroom CS6 - can't seem to find anything like that, but the CC version. Help, please!

    I can't find a link where I can download Lightroom CS6.
    It seems that Adobe is really the CC application but I really don't want to get the collection of cc.
    Already, I have the CS6 Master collection and am now just need to lightroom.

    Help, please!

    Thank you

    Please try to Download Photoshop Lightroom from here.

  • What is the version of dreamweaver that creates the most web friendly search engine?

    What is the version of dreamweaver that creates search engine friendly web mostly?

    All versions of Dreamweaver are able to produce good web pages, providing the person who uses, she knows how.   It is not the tool.  It is the skill of the person using it.

    Search engine optimization comes down to the base of 3 things:

    1. You need to have lots of keyword rich, relevant and unique content on your pages.
    2. You have to organize this content in good semantic markup (h1, h2, h3... tags p and li).
    3. You must get other web sites respected post links to your web site.

    See Google SEO Starter Guide

    http://googlewebmastercentral.blogspot.com/2010/09/SEO-Starter-Guide-updated.html

    Nancy O.

  • How to set a value that returns the value zero to O

    Hello, I have a xml field that returns null... I want 0 to replace the null value... How do in implementing in shape... pls let me know

    Use
    If set to NULL, it replaces with 0, VAL else displayed.

  • Windows 7 is not find all files that contain the phrase that I have sought in their name

    I am looking for files with a certain expression in name. When I type top-right search gives me some files with this phrase in their name and then I cut them in the file. But when I go in the file I searched, I still see a lot of files that contain this phrase in their names that do not appear in the search.

    Hello

    1 did you change on your computer?

    2 did you receive an error message?

    Method 1:

    I suggest you run the fixit tool and check.

    Difficulty of Windows Desktop Search when it hangs or no display of results

    http://support.Microsoft.com/mats/windows_search/en-us

    Method 2:

    I also suggest you to see link and check.

    Open the troubleshooter for search and indexing

    http://Windows.Microsoft.com/en-us/Windows7/open-the-search-and-indexing-Troubleshooter

    See also:

    Improve Windows searches using the index: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/improve-Windows-searches-using-the-index-frequently-asked-questions

  • what directory and the file name in windows 7 firefox bookmarks 6 are stored in? I can find everything but that in the help files.

    Seems obvious to me.

    places.sqlite in your profile folder.

    https://support.Mozilla.com/en-us/KB/profiles#w_how-do-i-find-my-profile

  • to refer to an object using a string value that is the name of the object

    is this possible? I want to do something like:

    String str = "classname";
    
    UiApplication.getUiApplication().pushScreen(str);
    

    Thank you

    If you want to use strings as keys use class java.util.Hashtable.

    Place your items for the hash table and retrieve it through the string of unique keys.

    Like this

    Hashtable myObjects = new Hashtable();
    myObjects.put("MyStringKey", myObjectReference);
    
    .......
    
    Object myObjectFromTable = myObjects.get("MyStringKey");
    
    if (myObjectFromTable instanceof Screen) {
      UiApplication.getUiApplication().pushScreen((Screen)myObjectFromTable);
    }
    
  • Find a value in the database

    Hi guys,.

    Don't know if I'm being paranoid here. But is there a way to search for a particular value in any of the tables in oracle.

    For example, I have a part called "AF2425-B12" in my table of the inventory number. Is there a way to find all tables that contains the value "AF2425-B12" in one of the columns in my database?

    Thank you very much

    Napster

    And/or:

    Ask Tom & quot; Search Quick Joker & quot;

  • Where can I find a store that will sell me a disc of Windows Vista?

    For the love of pete, I spent the last hour trying to find a place that sells the Vista operating system! This is getting ridiculous!

    original title: WHERE can I GET a DISK of the VISTA OPERATING SYSTEM?

    Why is - this ridiculous that you can't find support for an operating system that is not sold by the manufacturer more?
    http://Windows.Microsoft.com/en-us/Windows-Vista/products/get
    "Microsoft sells more than Windows Vista, although we will continue to support."

    Contact the Original Equipment Manufacturer (OEM - like Dell, HP, Gateway, Lenovo, etc) for your computer system and see if they can send you a replacement DVD.  They will probably charge you a small fee.  They also can only provide you with a set of restore/recovery - not a real installation DVD.

    What happened to * your * DVD to install it with?  You still have your product key?  You copy the product key and put him in a safe place (should be accompanied by a copy of your original DVD of Windows Vista)?  What about your applications?  What your backups?

    You can still find out there - but if you already have a license - it would be stupid to buy most of what you might find (as it would be another license product key /.)

    Find a friend, a member of the family or a - best bet - a nice computer scientist willing to help out you.  Someone you KNOW however.  Let them know which edition of Windows Vista and what type (OEM, retail) as well as the architecture (32-bit or 64-bit).

Maybe you are looking for

  • The title of my podcast changed suddenly

    Hello all, Hello Roger! A year ago, I created a podcast entitled "what the Duck". It was referenced that way on Itunes. Suddenly, a month ago the title became "No Title". My stream is created for a year on Feedburner, and I haven't changed anything a

  • How to turn off microsoft Narrator

    I want to turn off Microsoft Narrator.  How do we?

  • How to re-download the Microsoft Office came with the computer?

    My niece had her laptop 11 inspiron and now isn't sure how to get the Microsoft Office 2013 she bought when she was ordered to the laptop.  It was already installed and is not come with a disc that would not have worked since the laptop doesn't have

  • W 10 upgrade

    Dear Sir. I want to improve my window 7 using in SONY vaio at window 10. But because of the connectivity internet, he failed three times. So my query is can get CD/DVD by mail? If so then I can pay fees as appropriate

  • S2340M missing power adapter, Dell Outlet purchase

    I ordered as a monitor Dell of S2340M of Dell taking 8 months fair and recently there was time to connect to my computer. I discovered that the monitor has come only with the supply cable and not the AC adapter. I don't have the original packaging le