Get the sum of values and show only max(Date)

Hi,
I have a below query and the value
select PO_No,DATE,RCVD,LINE_QTY,QTY_INVCD,PART_NO from Purchase                         
PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
PO1460 12/02/2007 11     20     12     0995-13
PO1460 13/12/2006 4     20     12     0995-13
PO1460 05/04/2007 5     20     12     0995-13
In the above table,
PO_No ,Line_Qty ,Qty_INVCD,Part_No all are same value.
Now I want the sum ( rcvd,line_qty)
i.e.,
Select po_no,date,sum(rcvd) over (partition by line_quantity) RCVD,line_qty,qty_invcd,part_no from Purchase
Its look like
PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
PO1460 12/02/2007 20     20     12     0995-13
PO1460 13/12/2006 20     20     12     0995-13
PO1460 05/04/2007 20     20     12     0995-13
Now what I want is
I want the value for only max(Date)
b]PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
PO1460 05/04/2007 20     20     12     0995-13
How will I write a query?
Likewise I have many PO_No PO100,PO101,PO102,..........

No need to use subquery to get this result:
WITH data AS (select 'PO1460' po_no, to_date('12/02/2007','dd/mm/yyyy') datum, 20 recvd, 20 line_qty, 12 qty_invcd, '0995-13' part_no FROM dual
UNION all
select 'PO1460', TO_DATE('13/12/2006','dd/mm/yyyy'), 20, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1460', to_date('05/04/2007','dd/mm/yyyy'), 20, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1462', TO_DATE('13/12/2006','dd/mm/yyyy'), 30, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1462', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1462', TO_DATE('13/12/2006','dd/mm/yyyy'), 40, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1461', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1463', TO_DATE('13/12/2006','dd/mm/yyyy'), 30, 20, 12, '0995-13' FROM dual
UNION all
select 'PO1463', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
SELECT po_no, sum(recvd) keep (dense_rank first ORDER BY datum desc)
FROM data
GROUP BY po_no
will do the same

Similar Messages

  • How come my iPod Touch will not let me get the latest software update and will only let me have the 3.1 update?

    My iPod will only let me get the 3.1 update and I don't know how to get a later update.

    What happens when you try?
    Error message?
    Do you have the original ipod touch?  If so, then  3.1 is the latest software.

  • Pcr To Get The Wage Type Value From Previous Years Master Data Records

    Hi
    I have an issue related to pcr.  I want to get the value of a wage type from previous year and it has to be added to another wage type.  Tried to write pcr by using the operation TABLE.  But i am not able to get the previous years data.  Request to help in writing the PCR for the issue.
    Thanks
    EKP Yadav

    1 - Create an "Information WT" that will be saved into RT but that has no impact on net pay.
    2 - Create a PCR that will be activated on the last pay of the year to read the WT you want and transfer it's information into your Information WT.
    3 - Create a PCR that will read the last payroll results (activated with function PLRT) and transfer into the Input Table (IT) the Information WT.

  • I'm wanting to use the "Actions" in Photoshop Elements 11.  But when I get the Actions box up, it is only showing a small list of effects to use.  And no side bar to go any further.  When I click on the little arrow at top and then click on "load actions"

    I'm wanting to use the "Actions" in Photoshop Elements 11. But when I get the actions box up, it is only showing a small list of effects to use. And no side bar. So I can't go any further.  When I click on the little arrow at top and click on "load actions", I am only getting a box with empty space saying "No items match your search".  The folder at the top does say "Actions".  How do I get more effects?  The tutorials that I've checked into all show a long list of effects in their box.  Can anyone help? 

    To use the existing actions, try the following:
    1. Open one of the Action Sets, in this example Special Effects is the Action Set, by pressing the small arrow beside the set name.
    2. Then click on the name of the Action, in this example Faded Ink is the Action name.
    3. Then press the Play button to run the action.

  • How do I get the ipod nano 7th generation to only show the album artwork? the volume control, info bar and album artwork shows whenever a song is playing.

    How do I get the ipod nano 7th generation to only show the album artwork? the volume control, info bar and album artwork shows whenever a song is playing.

    Hi TheGuru146,
    It sounds like the iPod isn't restoring correctly. Try putting the it into Disk Mode manually and then restoring the iPod again as described in the article linked below.
    Putting iPod into Disk Mode
    http://support.apple.com/kb/ht1363
    iPod nano (7th generation)
    Before placing the iPod into Disk Mode, verify that it has a charge.
    Reset the device by pressing the Sleep and Home buttons simultaneously until the display shows the Apple logo. This should take about eight seconds.
    When the Apple logo appears, press and hold the Volume Down and Volume Up buttons simultaneously until the device enters Disk Mode.
    -Jason

  • HT1848 I am trying to transfer my purchases from my iPhone 5 to my new Mac computer.  I get the message stating that it can only be synced with one computer at a time.  I have tried the 2 other ways and I get no options to transfer my purchases.  Help?

    I am trying to transfer my purchases from my iPhone 5 to my new Mac computer.  I get the message stating that it can only be synced with one computer at a time.  I have tried the 2 other ways and I get no options to transfer my purchases.  Help?

    If you see Devices in the big list on the left-hand side of iTunes, it should show the name of your iPhone right below it. You can right-click (or hold ctrl and left click) on the name of the iPhone there, and choose "transfer purchases from iPhone".
    If you're on iTunes 11, you won't see the big list of the left until you go to the View menu at the very top (where you see iTunes/File/Edit/View/etc) and choose Show Sidebar. Then do the same thing: right-click or ctrl and left-click on the iPhone's name below Devices and "transfer purchases from iPhone".
    It'll ask you to authorize the computer for your Apple ID if you haven't yet; to do that, you just type your Apple ID and password in when it asks. If it says you are not authorized but doesn't automatically give you an option to do so, then you can go to the Store menu at the very top and choose "authorize this computer".

  • I have iMovie 09. I just erased my external hard drive, but it is still formatted for the mac. However, iMovie will not recognize the hard drive. It shows the only hard drive available is the computers. How do I get the external hard drive to show up?

    I have iMovie 09. I just erased my external hard drive, but it is still formatted for the mac. However, iMovie will not recognize the hard drive. It shows the only hard drive available is the computers. How do I get the external hard drive to show up?

    In Finder's Menu, select Go menu>Go to Folder, and go to "/volumes". (no quotes)
    Volumes is where an alias to your hard drive ("/" at boot) is placed at startup, and where all the "mount points" for auxiliary drives are created for you to access them. This folder is normally hidden from view.
    Drives with an extra 1 on the end have a side-effect of mounting a drive with the same name as the system already think exists. Try trashing the duplicates with a 1 or 2 if there are no real files in them, and reboot.
    If it does contain data...
    http://support.apple.com/kb/TS2474

  • I have the mini display port cable to hdmi.  When I connect I can get audio but on the video I get the display auro screen and can't get my actual display to show as that is not what shows on my display.  How can I fix this?

    I have the mini display port cable to hdmi.  When I connect I can get audio but on the video I get the display auro screen and can't get my actual display to show as that is not what shows on my display.  How can I fix this?

    System Preferences>Displays
    There is a little white bar. When you have your TV connected, move the white bar to the other display. Your main desktop is now the TV screen

  • How do I get the iCloud to save and sync and upload info from both the devices on my account. Right now I can only do one

    How do I get the iCloud to save and sync and upload info from both the devices on my account. Right now I can only do one

    You must put each device on the Verizon cloud.
    Not both lines on one.
    Go and set up a my Verizon account for the second line and you will have Verizon cloud service on that line.
    Oh the term "icloud" is a trademark of Apple Inc. Verizon is not Apple.
    Good Luck

  • I hit Forget Network and now cannot get back onto my wireless home network. All of my other computers and iphones are fine.  How do I get the network back?  It shows in my list of networks but when I use the password and try to join it says not connected.

    I hit Forget Network and now cannot get back onto my wireless home network. All of my other computers and iphones are fine.  How do I get the network back?  It shows in my list of networks but when I use the password and try to join it says not connected.

    See if the iPad will accept the password after you restart it. It's worth a try.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    You could also try a reset as well.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • TS3694 I keep getting the error message "-42408" and all of my apps got deleted on my iPhone. It says that I need to authorize my computer, so I tried than and that's when the error message showed up. I'm pretty ****** and want my apps to be back on my iP

    I keep getting the error message "-42408" and all of my apps got deleted on my iPhone. It says that I need to authorize my computer, so I tried than and that's when the error message showed up. I'm pretty ****** and want my apps to be back on my iPhone. Please help.

    What version of iTunes are you using?  The error you references seems to be connected with iTunes 9.0.4.  That version of iTunes is not compatible with iOS 6. You need to update to the current version of iTunes.

  • I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    Hey bill.rizzo2,
    Thanks for the question. I understand your phone number is missing on your iPad as an option for iMessage. The following article provides steps to resolve this issue:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Phone number missing on iPad or iPod touch
    If your phone number isn't listed on an iPod touch or iPad, follow these steps:
    1. Update to the latest version of iOS.
    2. Verify that you're using the same Apple ID that you're using on your iPhone.
    3. On your iPad or iPod touch, sign out of your Apple ID in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    4. Sign in to your Apple ID with FaceTime and iMessage.
    If your phone number still isn't listed, follow these steps:
    1. Sign out of your Apple ID on all iOS devices, including your iPhone, in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    2. Sign in to your Apple ID on your iPhone.
    3. When activation is complete, your Apple ID and all verified email addresses should be visible in Settings > Messages > Receive At and Settings > FaceTime.
    4. Sign in to your Apple ID on your other iOS devices.
    Thanks,
    Matt M.

  • How do i get iPhoto to time phase? (meaning take the same pic pose and show it over time)

    how do i get iPhoto to time phase? (meaning take the same pic pose and show it over time)

    I'm not sure that this is  something that iPhoto does. However, neither is it something I quite understand. What do you mean by "pic pose"?
    Regards
    TD

  • When and How to get the Text.ScrollPos value of a String control when scroll bar position changed

    Hi, 
    I'm working on a feature triggered by scroll bar position of a string control changed.
    But I could not find a good way to catch the scroll bar position changed event, 
    the scroll bar is controlled manually by mouse down → mouse move → mouse up, I want the get the Text.ScrollPos value when user mouse up, and compare with the maximum value.
    But the problem is,  mouse up on the scroll bar could not trigger String: Mouse up event!
    So I have to get the Text.ScrollPos continuously in the background in Timeout event, but I think it’s not efficient.
    Do you have any better idea on when to get the correct destination value of Text.ScrollPos?
    I plan to store the value of Text.ScrollPos in the bottom(maximum value) in a shift register, then compare the current Text.ScrollPos value with the max one.
    If it comes close to the bottom(90%~100% of the maximum value), then the close to bottom LED will turn on.
    Attachments:
    scroll bar pos changed.vi ‏15 KB

    Hello Cecilia,
    I don't think there is any build-in event for this.
    One solution would be to create your own user event at the initialisation of you main and launch a thread which is going to be pulling the value of your scrollbar position:
    Then you can build your main as if they were a scrollbar move event.
    And dont forget to close the thread and destroy the event at the end.
    Hope it helps.
    Attachments:
    Scrollbar event.PNG ‏10 KB

  • I have iphone 6 plus. When i am connecting it to my Hyundai Grand i10 using Bluetooth and trying to call someone, unable to get the ringing sound. Sound comes only when the person receives a call.

    I have iphone 6 plus (IOS 8.0.2). When i am connecting it to my Hyundai Grand i10 using Bluetooth and trying to call someone, unable to get the ringing sound. Sound comes only when the person receives a call.

    Hello Mogulman46,
    So what that means is when you have Do Not Disturb turned on, you may have an alert depending on the setting and how you are using your iPhone. So if it is set to Always, then that means that no matter what, your iPhone will not be notified. If it set to Only while the iPhone is locked, then that means that you will not get notification when your iPhone is locked but you will get notifications if your iPhone is being used. Also keep in mind the settings All Calls From can be set to certain contacts like Favorites, Everyone or no one. If you are using Do Not Disturb and you do not need it, then turn it off. 
    Use Do Not Disturb on your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/ht5463
    Regards,
    -Norm G. 

Maybe you are looking for

  • How can I check my icloud account on my pc

    how can I check my icloud account on my pc

  • Screen Not Working Correctly- Horizontal Lines

    For the past few weeks, when I open my computer, sometimes the bottom half of my screen is just a lot of lines or is not working correctly. Sometimes if I tilt the screen enough, it will go away. But I don't know what to do!

  • Can I install a SATAII/SATAIII SSD in an 2.16 C2D 2006 iMac?

    As the title suggests, I am after info on anyone who has a 2.16Ghz Intel Core 2 Duo iMac and has upgraded the hard drive to be a SSD. My iMac is going in for repair this weekend due to a broken power supply, I had the original 500GB hard drive taken

  • Target plays in simulator... but not on disc!

    I've wasted 4 DVD's because of this. I click the button in simulator, and it faithfully plays the clip and returns me to the proper jumpback. But burn the disc and try it, and I'm immediately shiunted to the top of the menu; I can't play the clip at

  • Error while doing ME57

    All, I have activated version Management for PR. Now I have generated a PR and saved it , after that done the releases . Then I have executed ME52N and add some text in item level . Then again saved the PR. Now I am doing conversion of PR into PO , w