How to get the Max value with other columns data also.

Suppose that a query is covered with the data as

Time of ID
01 07/12/2014
02 07/05/2014
03 16/07/2014
04 07/07/2014

I need to get the ID and time to time max.
that is, should I get
Time of ID
03 16/07/2014

To do this, I wrote a query that gives me necessary data. But I thought that's the best way?
Is it an effective way to get this data?
My query that returns the data required is:

SELECT ID, MAX_DT FROM
(
Select 'DUMMY', ID, TIME1, MAX (TIME1) OVER (PARTITION 'DUMMY') AS MAX_DT FROM TAB1
WHERE ID IN (BLAH BLAH)
)
WHERE MAX_DT = (EDT) 1

Frank mentioned links


WITH test_data (id, time) LIKE)

SELECT 01, to_date('2014/07/12','yyyy-mm-dd') FROM dual

UNION ALL

SELECT 02, to_date('2014/07/16','yyyy-mm-dd') FROM dual

UNION ALL

SELECT 03, to_date('2014/07/16','yyyy-mm-dd') FROM dual

UNION ALL

SELECT 04, to_date('2014/07/07','yyyy-mm-dd') FROM dual

)

SELECT id, time

go (select id,

time,

Max (Time) on latest_time (order by time lines between unbounded preceding and following unbounded)

of test_data

)

where time = latest_time

ID TIME
3 16/07/2014
2 16/07/2014

Concerning

Etbin

Tags: Database

Similar Questions

  • Get the max value with other areas

    Hi all

    I have a table as below

    Value name
    - - - - - - - - - - - - - - - -
    A1 5
    A3 10
    A2 7
    A2 9
    A1 10

    What I get is the max (Value) and with the consolidation of its name

    Value name
    - - - - - - - - -
    A2 16

    Thank you
    Alex

    Published by: user8606416 on June 1, 2011 10:17

    Published by: user8606416 on June 1, 2011 10:26

    Depends on how you feel on one of the links of:

    SELECT name, value
    FROM (SELECT name, SUM(value)
          FROM table
          GROUP BY name
          ORDER BY 2 DESC)
    WHERE rownum = 1
    
    SELECT name, SUM(value)
    FROM table
    GROUP BY name
    HAVING SUM(value) >= ALL (SELECT SUM(value)
                              FROM table
                              GROUP BY name)
    

    among many other methods. The first takes a single arbitrary registration in the case of a tie, and the second shows all the related records.

    John

  • How to get the Max value in Essbase

    Hello

    I have problem to get the max value of 3 years in Essbase.
    How can I get the max value of Dec 2009, Dec 2010, Dec 2011.
    Suppose the value of Dec 2009 = 1000, dec 2010 = 1500 and Dec 2011 = 2000
    I want to get the max value of these three value, how can I do this in the Essbase calculation Script.
    Any idea?


    Thank you.

    Kind regards

    Joni

    You did not specify if year and period are there separate dimensions, in any case as always a number of different possbilities and I don't have much time today to think about, but only one method can be to use @MAXRANGE

    DIFFICULTY (other members to set, 'Dec')

    'MemberToStoreAgainst' = @MAXRANGE("MemberToFindMaxRangeFor","2009:"2011");

    ENDFIX

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to get the numeric values with SCPI on an AG7034B

    Hello

    I use an Agilent 7034 osciloscope with 4 analog and 16 digital channels.

    Read analog channels is no problem, but how do I get the digital channels (101010) waveform?

    I see the digital signal on the screen of the instrument.

    And: I want to do with SCPI commands and read/write Visa.

    Thanks for all tips

    Do you really mean the DSO7034B? If so, there are drivers available for LabVIEW and other programming environments. I suggest you only start with one of these. Check your manual to become familiar with the controls.

    PS ad to the digital I/o Board is incorrect.

  • How to get the return value from Java runtime.getRuntime.exec?

    I am running shell from a (GR 11, 2) Oracle database commands on aix.
    But, I would get a return value of a shell comand... as you get with "echo $?"

    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
    
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
    }
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        }
        return retval;
    };
    /
    but I do not get a return value... because I don't know how to get the return value...

    Published by: user9158455 on 22-Sep-2010 07:33

    Hello

    Your pr.exitValue () has tried?

    I think you also need a finally block that destroys the sub-process

    Concerning
    Peter

  • Get the Max values and average of the different cycles in the single channel

    Hello

    I'm trying to get the Max values and average of the single channel that has different cycles it contains. I tried to use commands such as Chnclasspeak3 and chnpeakfind, but they were not useful for me. What I need is the Max values and average of the different cycles numbers saved in the data channel.

    Exampld if the string contains 5 numbers of repetitive cycles, then we must find the maximum values and the average of these 5 cycles in the single channel. Attached reference data. This is the .raw file and I have the plugin for it to use in diadem 11.1.

    Kind regards

    X. Ignatius

    Hello, Ignatius,.

    Sorry, it took some time to provide a replacement based on the script for the function. Please take a look at the attached script. I changed the script to use my function if the tiara-version is less than 12. My script function is not as fast and more stable than the implementation of tiara, but for now, it does the job

    Andreas

  • How to get the decimal value of a string of international currency

    Hi all

    How to get the decimal values to a string of international currency.

    Finally, we get to the real problem.

    You can use location functions or write your own using string functions already mentioned...

    http://developer.BlackBerry.com/native/documentation/Cascades/device_platform/internationalization/

  • How to compare the new values with the old values in triggers.

    Dear all,

    Please tell me how to compare the new values with the old values in triggers.

    Hi, the employee example is in the document. You'd better read yourself.

    CREATE OR REPLACE TRIGGER Print_salary_changes
      BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
      FOR EACH ROW
    WHEN (new.Empno > 0)
    DECLARE
        sal_diff number;
    BEGIN
        sal_diff  := :new.sal  - :old.sal;
        dbms_output.put('Old salary: ' || :old.sal);
        dbms_output.put('  New salary: ' || :new.sal);
        dbms_output.put_line('  Difference ' || sal_diff);
    END;
    /
    
  • DVT:pivotFilterBar - how to get the selected values of the filter

    Hi all

    I have a question: how to get the selected values from the pivot table filter bar programmatically?

    I tried to use
    pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);
    but to the edge of the side DATA INCORRECTESdeclarations page, it seems that it will return the cached values.

    Environment: JDev 11.1.1.3.0 without tasks.

    Thank you
    Miroslaw

    Hello

    You can retrieve the value selected in the PivotFilterBar through the PivotFilterBar model, instead of dataaccess:

    Download the template of the bar pivot filter instance
    QueryDescriptior queryDescriptor = (QueryDescriptor) pivotFilterBar.getValue ();

    retrieve a list of criterion, each of them is used to fill each lov in the pivot filter bar
    ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion ();
    List criterionList = conjunctionCriterion.getCriterionList ();
    for (int i = 0; i)<_criterionList.size(); i++)="">
    AttributeCriterion = (AttributeCriterion) criterionList.get (i) criterion.

    _selected is the currently selected value
    Selected object = criterion.getValues () .get (0);

    System.out.println (_selected);
    }

    Hope that helps,
    Chadwick

  • How to get the RGB value of a pixel in a psd document using scripting Photoshop

    Hi, guys!    Does anyone know how to get the RGB value of a pixel in a psd document using scripts in Photoshop?  I myself have missed for a long time and could not resolve. I am very happy to hear your voice as soon as possible!

    Here is an example...

    var originalUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var doc = activeDocument;
    var Colour1 = GetHexColour(eyeDropperRGB(1,doc.height-1));
    var Colour2 = GetHexColour(eyeDropperRGB(20,doc.height-5));
    var Colour3 = GetHexColour(eyeDropperRGB(40,doc.height-14));
    alert("Colour 1 = " +Colour1 + "\rColour 2 = " +Colour2 + "\rColour 3 = " +Colour3);
    var decColour = eyeDropperRGB(40,doc.height-14);
    alert("Red = " +decColour[0] + "\rGreen = " +decColour[1] + "\rBlue = " +decColour[2]);
    app.preferences.rulerUnits = originalUnits;
    function GetHexColour(reqHex){
    var out='';
    for(No in colours = reqHex){
     out = out.concat(zeroPad(d2h(reqHex[No]),2));
     }
    return out;
    };
    function eyeDropperRGB(x,y) {
     var x2 = x + 1;
     var y2 = y + 1;
     var out = new Array(3);
     activeDocument.selection.select([[x,y], [x2,y], [x2,y2], [x, y2]], SelectionType.REPLACE, 0, false);
     for(ch in list = ["Red", "Green", "Blue"]) {
     histogram = activeDocument.channels[list[ch]].histogram;
      for (i = 0; i <= 255; i++) {
       if (histogram[i]) {
        out[ch] = i;
        break;
       }
      }
     }
      return out;
    };
    function d2h(d) {return d.toString(16);}
    function zeroPad(n, s) {
       n = n.toString();
       while (n.length < s)  n = '0' + n;
       return n;
    };
    
  • How to get the Max of elements of type datetime value

    Hi all
    I wanted to get the last value timestamp (DateTime data type) of the node list. I have the following xml. In this xml file, I want to get the modifydate element that has the last time stamp via xquery/xpath, it should return me following result 2011-09-29 T 17: 21:17 + 10:00

    < CustomerList >
    < CustomerDetails >
    < Name > Test 1 < / name >
    assets of < status > < / status >
    < modifyDate > 2011-08-20T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >

    < CustomerDetails >
    < Name > Test 2 < / name >
    Cancel < status > < / status >
    < modifyDate > 2011-08-29T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >

    < CustomerDetails >
    < Name > Test 3 < / name >
    assets of < status > < / status >
    < modifyDate > 2011-09-29T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >
    < / CustomerList >


    I tried to use the
    CustomerList/CustomerDetails/modifyDate [not (. < =... / the above - sibling:CustomerList/CustomerDetails modifyDate) and not (. < =... / following - sibling:CustomerList/CustomerDetails modifyDate)]
    But it does not work on the datetime data type.
    Any help in this regard is highly appreciated.

    Concerning

    Published by: user6736659 on Sep 5, 2011 06:15

    Hello

    The following XQuery query should give you what you want:

    max(
     for $i in /CustomerList/CustomerDetails/modifyDate
     return xs:dateTime($i)
    )
    

    For example, by using Oracle SQL:

    SQL> var xmldoc varchar2(4000)
    SQL> begin
      2   :xmldoc := '
      3  
      4   Test 1
      5  active
      6  2011-08-20T17:21:17+10:00
      7  
      8
      9  
     10   Test 2
     11  cancel
     12  2011-08-29T17:21:17+10:00
     13  
     14
     15  
     16   Test 3
     17  active
     18  2011-09-29T17:21:17+10:00
     19  
     20  ';
     21  end;
     22  /
    
    PL/SQL procedure successfully completed
    
    SQL> select xmlquery('max(
      2   for $i in /CustomerList/CustomerDetails/modifyDate
      3   return xs:dateTime($i)
      4  )'
      5  passing xmltype(:xmldoc)
      6  returning content
      7  )
      8  from dual
      9  ;
    
    XMLQUERY('MAX(FOR$IIN/CUSTOMER
    --------------------------------------------------------------------------------
     2011-09-29T17:21:17.000000+10:00
     
    
  • How to get the internal values of Photoshop one ID assigned

    I have difficulties to obtain values for the internal settings.  It's less hard to set, you can use the Listener Script to get the code to use.  Presumably, you use executeActionGet() with an ActionReference.  The problem is to know how to build the ActionReference.  It doesn't seem to be a lot of documentation on that.

    My immediate problem is how to get the parameters of the 3D camera. I know this requires Photoshop Extended, but the principle must be the same.  This code sucessfully defines these parameters:

    < code >

    function setPhotoshopCamera (angleX, angleY, angleZ, posX, posY, posZ) {}
    Camera
    var idGet3DCamera = stringIDToTypeID ("get3DCamera");
    var idSet3DCamera = stringIDToTypeID ("set3DCamera");
    var descCamera = new ActionDescriptor();

    Camera position
    var idKey3DCurrentCameraPosition =
    stringIDToTypeID ("key3DCurrentCameraPosition");
    var descCameraPosition = new ActionDescriptor();

    var idkeythreeDXPos = stringIDToTypeID ("key3DXPos");
    descCameraPosition.putDouble (idkeythreeDXPos, posX);
    var idkeythreeDYPos = stringIDToTypeID ("key3DYPos");
    descCameraPosition.putDouble (idkeythreeDYPos, posY);
    var idkeythreeDZPos = stringIDToTypeID ("key3DZPos");
    descCameraPosition.putDouble (idkeythreeDZPos, posZ);
    var idkeythreeDXAngle = stringIDToTypeID ("key3DXAngle");
    descCameraPosition.putDouble (idkeythreeDXAngle, angleX);
    var idkeythreeDYAngle = stringIDToTypeID ("key3DYAngle");
    descCameraPosition.putDouble (idkeythreeDYAngle, angleY);
    var idkeythreeDZAngle = stringIDToTypeID ("key3DZAngle");
    descCameraPosition.putDouble (idkeythreeDZAngle, angleZ);
    descCamera.putObject (idKey3DCurrentCameraPosition,
    (idKey3DCurrentCameraPosition, descCameraPosition);

    These must be defined in the ActionDescriptor to make it work,

    // , but we do not have them
    var idkeythreeDCurrentFStop = stringIDToTypeID ("key3DCurrentFStop");
    descCamera.putDouble (idkeythreeDCurrentFStop, 0.000000);
    var idkeythreeDCurrentFDist = stringIDToTypeID ("key3DCurrentFDist");
    descCamera.putDouble (idkeythreeDCurrentFDist, 0.500000);
    var idkeythreeDCurrentFocalPointX = stringIDToTypeID ("key3DCurrentFocalPointX");
    descCamera.putDouble (idkeythreeDCurrentFocalPointX, 0.500000);
    var idkeythreeDCurrentFocalPointY = stringIDToTypeID ("key3DCurrentFocalPointY");
    descCamera.putDouble (idkeythreeDCurrentFocalPointY, 0.500000);
    var idkeythreeDCurrentFOV = stringIDToTypeID ("key3DCurrentFOV");
    descCamera.putDouble (idkeythreeDCurrentFOV, 30.000000);
    var idkeythreeDOrthographic = stringIDToTypeID ("key3DOrthographic");
    descCamera.putBoolean (idkeythreeDOrthographic, false);
    var idkeythreeDOrthographicScale = stringIDToTypeID ("key3DOrthographicScale");
    descCamera.putDouble (idkeythreeDOrthographicScale, 6.928203);
    var idkeythreeDViewIndexString = stringIDToTypeID ("key3DViewIndexString");
    descCamera.putString (idkeythreeDViewIndexString, "");
      


    var / / desc = executeAction (idSet3DCamera, descCamera, DialogModes.ALL);
    return of ESCR;
    }

    < code >

    The problem is that it does not work unless you also set the lower elements.  I want to leave what they are currently defined, but I don't know how to get these values.  Apart from that, I'll get the values of position of camera beforehand.  9 ID, string or otherwise, this should be necessary are known from the top.

    I assume you are using something like:

    < code >

    Var ref = new ActionReference();
    ref.putIndex (idkeythreeDCurrentFStop, idkeythreeDCurrentFStop);
    var / / desc = executeActionGet (ref);
    < code >

    However, I was unable to get something to work.  I am not sure

    1. That of the putXXX method to use.
    2. What to use for the desiredClass, which is the first argument.

    Any help would be appreciated.

    That you will get the 3DCurrentCameraPositon

    var ref = new ActionReference();
    ref.putEnumerated( zTID("Lyr "), zTID("Ordn"), zTID("Trgt") );
    var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('layer3D')).getObjectValue(stringIDToTypeID('key3DState')).getObjectValue(stringIDToTypeID('key3DCurrentCameraPosition'));
    

    Which returns a descriptor with the following keys.

    Key 0 = key3DXPos: DescValueType.DOUBLETYPE
    1 key = key3DYPos: DescValueType.DOUBLETYPE
    2 = key3DZPos key: DescValueType.DOUBLETYPE
    3 = key3DXAngle key: DescValueType.DOUBLETYPE
    Key 4 = key3DYAngle: DescValueType.DOUBLETYPE
    5 = key3DZAngle key: DescValueType.DOUBLETYPE

    At least with my sample 3D layer. I don't really do a lot with the 3D, so there may be other keys.

  • How to get the updated values of the loops while they are running

    Hello

    I am trouble with a very basic problem, how to access the updated values of the "loop FOR" during operation?  Basically, the VI I is currently working on two sub vis calls each sub VI has a loop for, and the two screws may or may not work for the same number of iterations. My goal is to read the values in each terminal within the loop of two sub VIs, in primary VI. I tried to do this using Global Variables, but in main VI it will display only the last iteration of the two value sub live. Could someone please tell me whrere I go wrong? Is there any other/better way to do this.

    I appreciate any input on this issue.  

    Pass a reference of the main VI control to the Sub screws.  See attached example.

  • How to get the peak value

    Can I know how to get the 2 peak values v1 and v2 and 2 duration times t1 t2.

    Since there is a small amplitude noise, difficult to use the Max simplely.

    May need to use a filter such as wavelets or TREE to Denoise it first. Can I know how to use, any Toolbox in labview. How do the curve smooth first.

    Thank you.

    I can't watch your vi now (I'm at work), but if your signals are long enough, you might consider a median filter.  You can set the number of points before and after use.  I found that it is useful for some smoothing problems (not all).

  • How to get the fnd_profile.value in the host program

    Hi all

    How to get the FND_PROFILE. VALUE('ORG_ID') in the host program.

    I loved not below, but it failed.

    v_return =' $ORACLE_HOME/bin/sqlplus - s $FCP_LOGIN < < END

    set pagesize 0

    trigger the echo

    fnd_profile. Value ('ORG_ID');

    EXIT;

    END '

    echo $v_return

    but it error with the message: Retrun value SP-0734: unknown command beginning "fnd_profile...". »

    Kind regards

    UVA

    > but it error with the message: Retrun value SP-0734: unknown command beginning "fnd_profile...". »

    .. .who is the same thing that will happen if you run SQL * more and type "fnd_profile.value...". »

    Assuming that fnd_profile.value is a function, you must select from the something (say double) or assign to a variable.

Maybe you are looking for

  • to clear the cache before loading each page

    I can't access a particular Web site. I can reach other sites very well. I had it happen with another site and my history of compensation has solved the problem. Now, it's another site. If I clear my history (cache, cookies) I can get to the first pa

  • Apps to say no internet connection after 9.3

    After the upgrade to 9.3 different applications like hay day and yahoo weather, say I have no internet connection, but the internet is fine. My daughters works very well and does not say that, and we are on the same internet connection. It's never ha

  • Re: Windows 7 32-bit to 64-bit upgrade

    I am a newbie to the forum. I recently gave a series of t60p 2623 with the 7200 T processor and 3 GB of RAM shown and has an ATI X 1300 display adapter. It features 32-bit, XP Professional, and I would like to make a clean Windows 7 Home Premiun or p

  • You can change the height of a digital indicator in LabVIEW 2010?

    It seems that you could have is LV 7.1 such that referenced by this article: http://digital.NI.com/public.nsf/allkb/AFCA584E0A70774586256E970052AFC3 However, I also found that in 8.5 you apparently cannot resize the height of the indicator/control...

  • "An unauthorized change has made for Windows".

    I have a computer that is running Windows Vista Edition Home Premium x 64. When I start it, I get a prompt indicating: Activating Windows "An unauthorized change has made for Windows". "Windows found a change which will result in limited Windows func