using max to get the last question of the information

Hi all

I have the sample data below
create table ty
( id varchar2(200),
  place varchar2(200),
   ty_date date,
   qty number(30)
   
   );
   
   
   insert into ty
       (id, place, ty_date, qty)
     values
       ('A', 'NY', sysdate, 10);
       
           insert into ty
       (id, place, ty_date, qty)
     values
       ('A', 'NY', sysdate, 11);
     
        insert into ty
       (id, place, ty_date, qty)
     values
       ('A', 'MN', sysdate, 12);
     
        insert into ty
       (id, place, ty_date, qty)
     values
       ('B', 'DC', sysdate, 12);
     
        insert into ty
       (id, place, ty_date, qty)
     values
       ('B', 'DC', sysdate, 13);
     
examples of data


ID PLACE QTY V_DATE
NEW YORK 11-5/10 / 2011 13:43:08
NEW YORK 10 5/10 / 2011 13:43:03
A 12 5/10 MINUTES / 2011 13:43:12
B DC 12 5/10 / 2011 13:43:16
B DC 13 5/10 / 2011 13:43:20



and this is the output I desired. the output is the latest data at the last seconds
ID PLACE   QTY   t_date
A  NY        11    5/10/2011 1:43:08 PM
A  MN        12    5/10/2011 1:43:12 PM
B  DC         12    5/10/2011 1:43:16 PM
B  DC         13    5/10/2011 1:43:20 PM
I tried to use the following code to get
select id, k.place, k.qty, max(ty_date) from ty k
     group by id, k.place, k.qty;
but he is robed in the wrong exit and I think it has to do with my group of.

Any help is appreciated.
 select id, k.place, k.qty, ty_date
       from ty k
       where ty_date = (select max(ty_date) from ty k1 where k1.id = k.id and k.place = k1.place)

Tags: Database

Similar Questions

  • Cannot use windows update, get the message "site has encountered a problem and cannot display the page you are trying to view.

    original title: can't use windows update, get the message 'the website has encountered a problem and cannot display the page you are trying to view. I am running xp. Can anyone help?

    I can't use the update. Still get the same message. Fix - it for Windows can not solve the problem. I am running xp. Help, please!

    Hi Hojo11779,

    You can see the mentioned knowledge base article and check.

    You receive an error message "Windows Update has encountered an error and cannot display the requested page" when you try to install an update

    http://support.Microsoft.com/kb/883614

    Let us know if it helps.

  • Hello, the following problem, I use a PC, can not use Photoshop, you get the text following error message on the computer-Adobe Photoshop CC 2015 has stopped working "close the program". have uninstalled and installed a number of times, but the CC2015 wil

    Hello, the following problem, I use a PC, can not use Photoshop, you get the following error message on the computer-Adobe Photoshop CC 2015 has stopped working " ", "the program '. '. have uninstalled et installed a number sometimes but the CC2015 does not start anyway. Soren

    Please see:

    Re: adobe photoshop cc 2014 has stopped working in windows 8

    Re: Photoshop CC 2015 has stopped working

    https://www.YouTube.com/watch?v=0OUdIZT7C2E

    I hope this helps.

    Concerning

    Megha Rawat

  • Get 7 Volume Info.vi returns an error when you try to get the information from disk on the cRIO-9025

    Hello

    I use a cRIO-9025 controller and want to get the information from the c: disk volume using the function to read the Volume information in the palette file I/O. When I run the function with the path as "C:\". ", the function returns a 7 error indicating that the path is incorrect.

    I used this function before with cRIO but unfortunately I have not any older devices with me to check this out now. I'm using LabVIEW 2009 SP1.

    Thank you very much!

    See you soon!

    Sankah2k

    On real-time targets VxWorks, the root of the path of the file is here (in lowercase). Try and let us know if it works. You would be better to use the constant path of the file to understand what looks like the path of the root directory.

  • What is the command of shortcut for all windows get the information from the computer?

    What is the command of shortcut for all windows get the information from the computer?

    instead of going to the computer / my computer > properties > discover the pc... basic information or go to the control panel...

    just a command for windows xp, vista, 7 for system looking for information....

    original title: what is the SHORTCUT COMMAND to get information from the computer system?

    Hello BlackSecret,

    The keyboard shortcut to get to the top of this information is Windows key + break Attn.

    Who does what you ask?
  • •EPMCSS-05261: could not get the information of the Aboriginal group.

    Hello

    Recently, we migrated user 11.1.1.3 11.1.2.3 version version.

    I tried to open one of the groups and clicked on the tab user membership in the group. I got the error message in the new version 11.1.2.3 below.

    «•EPMCSS-05261: could not get the information of the Aboriginal group.» Error getting to some of the affected user entries. Check the configuration and user directory State.

    Please could you let me know why we get this error message and no impact on the safety of the user.

    Thank you

    Michel K

    Read through the following Oracle Support document - "EPMCSS-05261: could not get the native group information (Doc ID 1619561.1).

    See you soon

    John

  • Using variables to get the answers to the questions of fill-in-the-White

    Hello

    Fill-in-the-blank questions, to provide answers. I want to provide these in the form of variables (user-created), rather than in the form of fixed strings (so, as $$ var1$ $ and not as 'Rabbit'). I could not get this to work. The variable input function is available (in the properties panel), but it does not in fact (i.e. even if you select a variable to be entered, it is not actually automatically registered).

    Is there a way around the problem?

    1. NB containing the same question for text entry boxes (rather than fill-in-the-blank questions). If I could get this works for text entry boxes, I'd use questions these rather than fill-in-the-white.

    2. a peut use variables for the answers to the multiple-choice questions. So I hope I can make it work for fill-in-the-blank questions as well.

    Thank you in advance. Marvin DuBois

    That would be my suggestion. I don't have a blog, but using BER of for this kind of questions me as well. And unlike the widget/interaction, that I've mentioned before, BER is an interactive object, which means it can be validated and that there may be a score attached to it. But, it will not help you, since you have to add the correct answers in the same way as for a drop-down list in the issue of the FIB (they are the sorts of TEB). And it is this list that does not enter a variable rather than a fixed sequence of characters.

    This means that you are into stocks advanced, identical to that of my blog posts with the widget/interaction.

    Have a work around (after all I'm the work around Queen) having intercourse, if you don't check that BER, described here:

    http://blog.lilybiri.com/report-custom-questions-part-2

    The idea is to use another interactive object that can have a score. Actually, I use two instances of the same object: a score of 0 and one with score of X and show the right according to the conditional action.

    However if you want to have multiple TEB on the same blade, which must be verified with the same tip action, you will need either the mastery of InfoSemantics (only for output SWF) widget or Javascript.

    Lilybiri

  • How can you add a device in MAX after getting the error 200220

    Hello

    I get the following error message when I start my datalogging software

    When I opened MAX, I noticed that the device NOR I use (USB-TC01) is not listed.

    Someone out there would be able to let me know how to add the TC01 device? I know that I need to go to the icon "create new" devices and Interfaces, but do not know how to proceed after that. I get the next screen but not sure what to select.

    I use the 9.0.2 version of NOR-DAQmx driver on Windows XP operating system.

    Thanks for your time,

    Kevin

    You may need to update your DAQmx driver.

    Look at this page.  http://sine.NI.com/PSP/app/doc/p/ID/PSP-916/lang/en

    All versions of DAQmx listed are more recent than the 9.0.2 you use.

    Also, take a look at this message thread.  http://forums.NI.com/T5/instrument-control-GPIB-Serial/NI-USB-TC01-not-found/m-p/1454196?requireLogi... which seems to confirm.

  • Try to update Windows XP SP3 Media Center by using Windows Update, get the error number: 0 x 80070424

    When you use Windows Update Center for Windows XP Media Center with Service Pack 3 installed, I now get the following message is displayed:

    [Error number: 0 x 80070424]
    The website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem.

    For self-help options:

    To support options:

    I looked at the FAQ which makes no mention of SP3 but support States SP2 is underway, can you help me?

    Hey PABear and John_P.

    I found another link, and it's worked perfectly

    http://www.techiecorner.com/112/error-number-0x80070424-in-Windows-Update-solution/

    Thanks a lot for your help, definetitely remember Windows Fix It for later use

    Dave

  • How to use JS to get the movieclip in the Web?

    Hello

    Look at this code example:

    JS of the canvas:

    (function (lib, img, cjs, ss) {
    var p; // shortcut to reference prototypes
    // library properties:
    lib.properties = {
    width: 550,
    height: 400,
    fps: 24,
    color: "#FFFFFF",
    opacity: 1.00,
    manifest: []
    };
    lib.ssMetadata = [];
    // symbols:
    (lib.mc = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});
    // ss 1
    this.shape = new cjs.Shape();
    this.shape.graphics.f().s("#FFFFFF").ss(1,1,1).p("ApwmjIThAAIAANHIzhAAg");
    this.shape.setTransform(62.5,42);
    this.shape_1 = new cjs.Shape();
    this.shape_1.graphics.f("#FF0000").s().p("ApwGjIAAtGIThAAIAANGg");
    this.shape_1.setTransform(62.5,42);
    this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(1));
    }).prototype = p = new cjs.MovieClip();
    p.nominalBounds = new cjs.Rectangle(-1,-1,127,86);
    
    // stage content:
    (lib.mymc = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});
    // mc
    this.mc = new lib.mc();
    this.mc.setTransform(215.5,167.1,1,1,0,0,0,62.5,42);
    this.timeline.addTween(cjs.Tween.get(this.mc).wait(1));
    }).prototype = p = new cjs.MovieClip();
    p.nominalBounds = new cjs.Rectangle(427.5,324.6,126,85);
    })(lib = lib||{}, images = images||{}, createjs = createjs||{}, ss = ss||{});
    var lib, images, createjs, ss;
    

    HTML:

    <body>
    <canvas id='canvas'></canvas>
    </body>
    <script>
    alert('lib.properties.fps')
    </script>
    

    My question:

    the canvas has a movieclip named "mc".

    How can I alert the 'mc' as alert the 'lib.properties.fps '?

    alert('lib.mymc')//success
    alert('lib.mc')//success,but it is library ,Not in the scene
    alert('lib.mymc.mc')//undefined,how do it?
    
    

    Thank you very much!!

    Hi, ClayUUID

    Thank you help!

    the JS of the Web is published, we can change it. I want to play the film of the canvas from the html file, so I get the film name or ID Witch of the Web.

    NOW I can solve this issue to share with everyone.we:

    Set a global variable to store the name of the instance you want, you can easily find it.

  • using script to get the values of percentage and not able to sum up to 100%

    Hi all

    I am trying to use a parseFloat() function to convert the string value as a percentage, and then try to add all the values of %.

    but for a few scenrios even if the amount is 100% of the service I get the PctValue be <>100.00%

    the calculation of the function is as follows: -.

    code-

    {iterating_through_all_the_fields}

    PctValue += parseFloat (this.getField("Percentage1").valueAsString);

    }

    sample-

    11.12

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    amount is 100

    but through code mentioned above I return 99.99

    Any help is appreciated in this regard.

    It is a result using the floating point IEEE standard and conversion from decimal to binary values values. We need to round up all the calculations of money or mils will accumulate and cause errors. For percentages, it is better to round up receipts and total final eliminate the accumulation of amounts below the figure the least significant.

    It is possible to use the util.printf of rounding.

    The following script will show what is happening:

    function Round (nValue, nDec) {}
    If (typeof nDec == "undefined") nDec = 0;
    Return number (util.printf ('%, 1 0. nDec + "f", Number (nValue)));
    }

    var nValues = new Array (11.12 11.11 11.11, 11.11, 11.11, 11.11, 11.11, 11.11, 11.11);
    nSum var = 0;
    for (var i = 0; i)< nvalues.length;="" i++="" )="">
    nSum = nSum + Round (nValues [i], 2);
    Console.println (i + "" + nValues [i] + "" + nSum);
    }
    Console.println (nSum);
    nSum = Round (nSum, 2);
    Console.println (nSum);

    Progression of the sum at each stage.
    0 11,12 11.12
    1 11.11 22.229999999999997
    2 11.11 33.339999999999996
    3 11.11 44.449999999999996
    4 11.11 55.559999999999995
    5 11.11 66.66999999999999
    6 11.11 77.77999999999999
    7 11.11 88.88999999999999
    8 11.11 99.99999999999999
    99.99999999999999
    100

    true

    It's a good idea to use decimal values a percentage and leave the determination of the field format display and the borough. But for applications of the sum, the user can round up the value of the actual field and not only display.

  • Function MAX to get the recent date does not work as expected

    Hello
    I recently started working on Oracle and came across this problem. I've coded below, given the query to obtain the most recent date in the table and compare with Sysdate + 1 timestamp. I am not able to understand what I coded wrong but the query gives me bad such results as explained below:

    Select NVL (MAX (to_char (max (last_update),' dd/mm/yyyy hh12:mi: ss AM')), to_char (sysdate + 1, ' dd/mm/yyyy') |') 12: 00')
    of Audit_Table_Name
    where col1 = 'AA '.
    and location_type = 'STATE '.
    and original_flag = 'Y '.
    Group of col1, location_type, original_flag;


    Here Max (last_update) of value Audit table contains--> 25/08/2009 12:00:00 AM
    Note: The last_update data type is Date
    If ideally, it should give 26/08/2009 12:00:00 AM, but surprisingly it gives 25/08/2009 12:00:00 AM as output. Can someone explain why this is happening and what to do to get the correct results?

    Kind regards
    Amol

    user11826653 wrote:
    Hello
    I recently started working on Oracle and came across this problem. I've coded below, given the query to obtain the most recent date in the table and compare with Sysdate + 1 timestamp. I am not able to understand what I coded wrong but the query gives me bad such results as explained below:

    Select NVL (MAX (to_char (max (last_update),' dd/mm/yyyy hh12:mi: ss AM')), to_char (sysdate + 1, ' dd/mm/yyyy') |') 12: 00')
    of Audit_Table_Name
    where col1 = 'AA '.
    and location_type = 'STATE '.
    and original_flag = 'Y '.
    Group of col1, location_type, original_flag;

    Here Max (last_update) of value Audit table contains--> 25/08/2009 12:00:00 AM
    Note: The last_update data type is Date
    If ideally, it should give 26/08/2009 12:00:00 AM, but surprisingly it gives 25/08/2009 12:00:00 AM as output. Can someone explain why this is happening and what to do to get the correct results?

    Kind regards
    Amol

    Your sysdate + 1 is the second half of your NVL function it will return only sysdate + 1 when max) last_update) is set to null. I think what you need is

    select to_char(greatest(max(last_update),trunc(sysdate)+1),'mm/dd/yyyy hh:mi:ss AM') 
    
  • If I buy a used ipad can get the changed password

    If I buy an ipad 2 opportunity get the password changed so the seller forgot it?

    If the seller forgot https://iforgot.apple.com/password/verify/appleid#! & section = password

    otherwise, you and the seller must go to an apple store with proof of purchase

  • I have Windows 7 32 - bit PC running, using uTorrent I get the BlueScreen error

    Signature of the problem:
    Problem event name: BlueScreen
    OS version: 6.1.7601.2.1.0.256.1
    Locale ID: 1033

    More information about the problem:
    BCCode: d1
    BCP1: 00000014
    BCP2: 00000002
    BCP3: 00000000
    BCP4: 8A2E4BF2
    OS version: 6_1_7601
    Service Pack: 1_0
    Product: 256_1
    The dump file is uploaded here:
    https://SkyDrive.live.com/redir?RESID=B0361FAAAC5DAD7D! 198
    And the Crash report:
    https://SkyDrive.live.com/redir?RESID=B0361FAAAC5DAD7D! 199
    So, how to stop this error?

    NETIO.sys crashes

    Folderlock is installed? I see that mfehidk.sys is also on this system, this belongs to Mcafee.

    0x000000D1 and netio.sys is a known BSOD caused by a Mcafee program. I would get the Mcafee removal tool and remove the rest of Mcafee, if you uninstalled

    Kaspersky AV is also installed

  • How to get the information via the API Rest Socialcast challenges?

    Hello

    Is it possible to get the challenges through socialcast REST API?

    API documentation

    I find particular endpoint of challenges.

    Can we get information of challenges as messages? I can see more details api message endpoint.

    "extensions associated with this message, which can include group data, thank you, challenges, project or town_hall"

    Message from API documentation

    Hello:

    We don't have an API of challenges available at this time. We release new API information on an ongoing basis, then please do not hesitate to consult the documentation periodically for updates.

    Thank you

    Socialcast VMware team

Maybe you are looking for