Query to grab the sum and the most recent values?

hi,
Just wondering if its possible to have a query on the temp table,
which fetches school,most_recent(sub1),sum(sub2),sum(sub3) group by school
table temp
SCHOOL DATE1 SUB1 SUB2 SUB3
ABC                    01-AUG-07 1 5 6
ABC                     02-AUG-07 2 5 6
ABC                     03-AUG-07 3 5 6
ABC                     04-AUG-07 4 5 6
ABC 05-AUG-07 5 5 6
XYZ                    01-AUG-07 6 7 8
XYZ                     02-AUG-07 7 7 8
XYZ                     03-AUG-07 8 7 8
XYZ                     04-AUG-07 9 7 8
XYZ 05-AUG-07 10 7 8
Just wondering if its possible to have a query on the temp table,
which fetches school,most_recent(sub1),sum(sub2),sum(sub3)
required output
SCHOOL SUB1 SUB2 SUB3
ABC 5 25 30
XYZ 10 35 40
thanks

I think you want this:
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
      7900 JAMES      CLERK           7698 03-12-1981        950                    30
      7902 FORD       ANALYST         7566 03-12-1981       3000                    20
      7934 MILLER     CLERK           7782 23-01-1982       1300                    10
      7876 ADAMS      CLERK           7788 12-01-1983       1100                    20
4 rows selected.
real: 63
SQL>select * from emp order by deptno;
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
      7782 CLARK      MANAGER         7839 09-06-1981       2450                    10
      7839 KING       PRESIDENT            17-11-1981       5000                    10
      7934 MILLER     CLERK           7782 23-01-1982       1300                    10
      7369 SMITH      CLERK           7902 17-12-1980        800                    20
      7876 ADAMS      CLERK           7788 12-01-1983       1100                    20
      7902 FORD       ANALYST         7566 03-12-1981       3000                    20
      7788 SCOTT      ANALYST         7566 09-12-1982       3000                    20
      7566 JONES      MANAGER         7839 02-04-1981       2975                    20
      7499 ALLEN      SALESMAN        7698 20-02-1981       1600        300         30
      7698 BLAKE      MANAGER         7839 01-05-1981       2850                    30
      7654 MARTIN     SALESMAN        7698 28-09-1981       1250       1400         30
      7900 JAMES      CLERK           7698 03-12-1981        950                    30
      7844 TURNER     SALESMAN        7698 08-09-1981       1500          0         30
      7521 WARD       SALESMAN        7698 22-02-1981       1250        500         30
14 rows selected.
real: 141
SQL>select * from emp a
  2  where a.hiredate in (select max(b.hiredate)
  3                       from emp b
  4                      group by b.deptno
  5                     );
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
      7900 JAMES      CLERK           7698 03-12-1981        950                    30
      7902 FORD       ANALYST         7566 03-12-1981       3000                    20
      7934 MILLER     CLERK           7782 23-01-1982       1300                    10
      7876 ADAMS      CLERK           7788 12-01-1983       1100                    20
4 rows selected.HTH
Ghulam

Similar Messages

  • My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    In the Music tab of iTunes, do you have 'Include Voice Memos' checked?

  • TS2518 I upgraded to Aperture 3.4 this morning, and now it will not open at all! It crashes every time, and tries rebuilding the library and repairing most times. The Library open fine in Iphoto

    Every time since I upgraded this  morning, attempting to open Aperture causes a crash. I upgraded to Aperture 3.4 this morning, and now it will not open at all! It crashes every time, and tries rebuilding the library and repairing most times. The Library open fine in Iphoto

    If you do not have the original install DVDs, use the Aperture Trial installer instead:
    Try if this download link for the trial version still works: if yes, you can unlock it with your serial number:
    http://appldnld.apple.com.edgesuite.net/content.info.apple.com/Aperture/061-8328 .20101020.AprE3/ApertureTrial3.1.dmg
    Regards
    Léonie

  • I have the latest generation ipad and just purchased an ipad mini but when signing onto the apple store, my most recent app purchases are not visible to download on my new ipad mini i.e. "receipe box"

    i have the latest generation ipad and just purchased an ipad mini but when signing onto the apple store, my most recent app purchases are not visible to download on my new ipad mini i.e. "receipe box".  How can i download onto the new ipad mini without paying again?

    Sign out, reboot and sign in
    Settings>iTunes and App Store>Apple ID

  • TS1424 I bought an album that also came with music videos. All the songs downloaded properly, but none of the videos. Next to them it said Stopped-Error 3150, I tried to restart the downloads and now most just say Stopped, some say Stopped-Error 8003. Hel

    I bought an album that also came with music videos. All the songs downloaded properly, but none of the videos. Next to them it said Stopped-Error 3150, I tried to restart the downloads and now most just say Stopped, some say Stopped-Error 8003, which means Network issues, but after checking, I found there are no issues with my network. Help?

    I am having this same problem with my brand new Mac Pro. It seems to be tied to the computer awaking from sleep (no I am not leaving the iPod connected while sleep... I am referring to waking the computer from sleep and then connecting iPod as opposed to restarting the computer and then connecting the iPod). In other words, if you are getting this error message, try ejecting the iPod, restart your computer, then connect the iPod and see if the error message goes away. For me it does, but I only get one shot at it, if I eject the iPod and then reconnect it, the error message returns. This happens on both iPods I have. I have rebooted (hold menu-select) and gone to disc mode (hold select-play) and the error message remains. The only way it goes away is to reboot the computer, then I get one shot at hooking up an iPod.
    I NEVER had nor get this error message when I connect to the Windows PC that I started with. Perhaps the iPod does not like moving from PC to Mac?

  • Get every 10 sec a int.value and need to take the sum of the last 18 values

    Hi,
    i get every 10 sec a int.value and need to take the sum of the last 18 values (3 minutes).
    the programm should work permanently.
    I tried with a 1d-array but didn´t get a result. Could anyone help me?
    Best regards
    kasche

    Use the example in the posted link, then add another shift register for your sum of all elements. Dont add all the elements every time, add them to a running total when they come in. You will need to evaluate how big this number is going to get, however, and decide if you should use an I64 for your running total of all elements. Even this will overflow eventually. 
    So your code would look like that posted by GerdW in the above link, then add a shift register with a starting value of 0. Then add your input value to the value comming from this shift register and send the output to the shift register's output terminal. This creates your running total of all values. The code by GerdW provides your "last 18 elements" total in a very efficient manner, just change the 15 to an 18.
    I have attached a sample bit of code to make it clear. I saved it in LV 8.0 so more people can open it.
    CyberTazer
    Software Systems Engineer
    Attachments:
    Running 18 total.vi ‏11 KB

  • The type and the length of the members of the structures

    I am making the BC-XAL program.
    Reading `XAL_Interface_Documentation_11.pdf', now I succeeded in "Reading All Saved Monitor Sets" and "Reading All Monitors of a Monitor Set". but I can't find the type and the length of the member of the Structure BAPITNDEXT, so I cannot get the Monitoring Tree of a Monitor.
    where can I get any documents or information ?

    This is how it looks in my 46c system.
    MTSYSID         SYSYSID         CHAR      8     0R/3 System, name of R/3 System                                 
    MTMCNAME        ALMCNAME        CHAR     40     0Alert: name of monitoring context                              
    MTNUMRANGE      ALTIDNUMRG      CHAR      3     0Alert: monitoring type number range (perm., temp, ...)         
    MTUID           ALTIDUID        CHAR     10     0ALert: Unique Identifier for  Monitoring Types (used in TID)   
    MTCLASS         ALTIDMTCL       CHAR      3     0Alert: monitoring type class (perf., single msg.,...)          
    MTINDEX         ALTIDINDEX      CHAR     10     0Alert: internal handle for TID                                 
    EXTINDEX        ALTIDINDEX      CHAR     10     0Alert: internal handle for TID                                 
    ALTREENUM       ALTREENUM       INT4     10     0Alert: MT Tree info: Number of tree                            
    ALIDXINTRE      ALIDXINTRE      INT4     10     0Alert: Tree Info: Index of MT in Tree                          
    ALLEVINTRE      ALLEVINTRE      INT4     10     0Alert: Tree Info: Level of MTE in Tree                         
    ALPARINTRE      ALPARINTRE      INT4     10     0Alert: Tree Info: Index of Parent of MT in Tree                
    OBJECTNAME      ALMOBJECT       CHAR     40     0Alert: Name of Monitoring Object                               
    MTNAMESHRT      ALMTNAMESH      CHAR     40     0Alert: Short Name of Monitoring Type                           
    CUSGRPNAME      ALCUSGROUP      CHAR     40     0Alert: Customization: Name of Customization Group              
    DELIVERSTA      ALDELIVSTA      INT4     10     0Alert: MT Val: Delivery Status                                 
    HIGHALVAL       ALVALUE         INT4     10     0Alert: alert value (1 = green, 2 = yellow, ....)               
    HIGHALSEV       ALSEVERITY      INT4     10     0Alert: severity (alerts, monitoring type custom..)             
    ALSYSID         SYSYSID         CHAR      8     0R/3 System, name of R/3 System                                 
    MSEGNAME        ALMSEGNAME      CHAR     40     0Alert: name of monitoring segment                              
    ALUNIQNUM       ALAIDUID        CHAR     10     0Alert: Unique Identifier to be used in AID (char10)            
    ALINDEX         ALINDEX         CHAR     10     0Alert: internal handle                                         
    ALERTDATE       ALDATE          DATS      8     0Alert: date                                                    
    ALERTTIME       ALTIME          TIMS      6     0Alert: Time value in timeformat                                
    DUMMYALIGN      ALDUMMYC2       CHAR      2     0Alert: Dummy field. Purpose: Alignment of date/time 16 byte    
    LASTVALDAT      ALDATE          DATS      8     0Alert: date                                                    
    LASTVALTIM      ALTIME          TIMS      6     0Alert: Time value in timeformat                                
    LASTVALDUM      ALDUMMYC2       CHAR      2     0Alert: Dummy field. Purpose: Alignment of date/time 16 byte    
    ACTUALVAL       ALVALUE         INT4     10     0Alert: alert value (1 = green, 2 = yellow, ....)               
    ACTUALSEV       ALSEVERITY      INT4     10     0Alert: severity (alerts, monitoring type custom..)             
    VALSYSID        SYSYSID         CHAR      8     0R/3 System, name of R/3 System                                 
    VMSEGNAME     ALMSEGNAME     CHAR     40     0     Alert: name of monitoring segment                                  
    VALUNIQNUM     ALAIDUID     CHAR     10     0     Alert: Unique Identifier to be used in AID (char10)                                  
    VALINDEX     ALINDEX     CHAR     10     0     Alert: internal handle                                  
    VALERTDATE     ALDATE     DATS     8     0     Alert: date                                  
    VALERTTIME     ALTIME     TIMS     6     0     Alert: Time value in timeformat                                  
    VALERTDUM     ALDUMMYC2     CHAR     2     0     Alert: Dummy field. Purpose: Alignment of date/time 16 byte                                  
    COUNTOFACT     ALCNTACTAL     INT4     10     0     Alert: MT Val: Count of active Alerts                                  
    COUNTSUM     ALCNTSUMAL     INT4     10     0     Alert: MT Val: Sum of Alerts in MT                                  
    VISUSERLEV     ALVISILEVL     INT4     10     0     Alert: MTE type dev cust: Visible on user level (op,exp,dev)                                  
    TDSTATUS     ALTDSTATUS     INT4     10     0
         Alert: MT: Type Def Status
    Welcome to SDN.
    Regards,
    Rich Heilman

  • Is there a way to see on itunes to all my songs the bpm and the key to every song?

    I have some external programs such as BPM Analyser or Mixmeister that i can scan all my songs and have the bpm and the key to every song!Is there a Plug-in or something else that i can have that as a "category" on Itunes so dont need to open another program to do that?It will be useful to the same list to have all and don't need to use external program.If someone know something about that please help.

    There's a field and column for BPM in iTunes - control-click on any of the column headers to see the full list, from where you can select the BPM column to appear. This if course presumes that the utility you're using will write the BPM information into that field; most will. There's no specific field for the key signature, so the utility would have to write that information into another field such as the Comments.
    Regards.

  • The sum of the confirmed quantity exceeds the sum of stock items

    Hi,
    I have two sales order. Material is same. Both of them related project stok.
    First sales order's qty=1. I created purchase order and post goods receipt.
    Second sales order's qty=2. I created only purchase order.
    I cannot create delivery for first sales order. System giving message.
    Information message : The sum of the confirmed quantity exceeds the sum
    of stock items
    20000978     10     Only 0 ST of material 7ML18301CF  available
    20000978     10     An item with no delivery quantity is not permitted. Item will be deleted.
    But I have a 1 qty on project stock.
    Please help me.

    hi,
    this is to inform you that,
    please run this report in SE38, SDRQCR21 if you have any inconsistencies in the system.
    it seems there is an issue with MARD-DISKZ  & please correct it.
    but i have a doubt MB51 is material document llist.  why you are checking stock there.
    please confirm.
    regards,
    baljia
    Edited by: balaji timmampalli achari on Nov 17, 2010 9:00 AM

  • My iphone 5 will not turn on and i connect it to the charger and the logo strats blinking what can i do or what is wrong?

    my iphone 5 has stop working it turnd off and it wont turn on i connect it to the charger and the logo strats blinking but it wont turn on, what can i do or what is wrong

    First try a Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least Ten seconds... (But can take Longer)... until the Apple logo appears. Release the Buttons
    If no joy... Try a Restore...
    1: Connect the device to Your computer and open iTunes.
    2: If the device appears in iTunes, select and click Restore on the Summary pane.
    3: If the device doesn't appear in iTunes, try using the Steps in this article to force the device into Recovery Mode.
    From Here
    http://support.apple.com/kb/TS3281
    Make sure you have the Latest Version of iTunes (v11) Installed on your computer
    iTunes free download from www.itunes.com/download
    Note on Recovery Mode.
    You may need to try this More than Once... Be sure to Follow ALL the Steps...
    Once you have Recovered your Device...
    Re-Sync your Content or Restore from the most Recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766

  • If you are traveling in Europe, do you need both an adapter AND a voltage regulator to charge the IPad2 and the iphone? Or, the reverse, will it hurt either if I use both the adapter AND the voltage convertor?

    If you are traveling in Europe, do you need both an adapter AND a voltage convertoro charge the IPad2 and the iphone? Or, the reverse, will it hurt either if I use both the adapter AND the voltage convertor?

    You may only need adapters for the different kind of sockets, depending of the country you want to travel. A voltage converter is not needed.
    The Apple power units are multi voltage devices, supporting a range from 110 V to 240 V. as you can see on the labels. O.K. for most of the labels you need a magnifier, but its on them.
    Have a pleasnt journey
    Lupunus

  • The cumulative balance displayed in FS10N does not match the sum of the det

    Hello,
    The cumulative balance displayed in FS10N does not match the sum of the details.  For example, we have a GL disbursement account that has a ***. Balance of 8 million.  The debit is 2 million and the credit is 10 million. But, when you drill down on the ***. Bal. for the current period, the sum of the details is 9 million.  According to our users, the 2 balances should equal.  I did a search in this forum and found 1 post stating they had the same issue and the answer was to run f.16. Has anyone experienced this and if so, how did you handle it?  I'm not sure how f.16 functions.  Do we have to run it for each consecutive year?  I'm not a FI specialist.  I'm responsible for data archiving and the users think it's related to archiving.  However, we have a test system that was resynced with production prior to when archiving was done and it shows that this issue is pre-existing.
    Thank you very much in advance,
    Lourdes

    Hello,
    There is a possibility that you have activate line item display for some of the accounts at a later stage. Meaning that earlier postings were not be shown for the earlier postings but only totals will be made available. Therefore, obviously there is bound to be difference between line item report and totals report.
    You need to identify which accounts are being changed with line item display at a later stage.
    In case if you forget to keep GL Line item display for an account, but the posting are already made the following steps you would required to get the line item display retrospectively.
    1. Note that you are NOT required to make the balance of that GL account to ZERO. Please do not confuse with Open Item Management.
    2. Put the check box line item display for the account in FS00. Make sure you are entering right company code.
    3. Block the account for posting in COA Segment and Company Code Segment in FS00
    4. Go to SA38 and run program RFSEPA01 (Give correct GL Account and Company Code)
    5. Now, remove the block you kept on the GL Account in FS00.
    This will reset the line item display retrospectively.
    Hope this will solve your problem.
    Regards,
    Ravi

  • Why is the video and the audio in iTunes drifting out of sync?

    This has been happening for awhile, and it is annoying me quite a bit.  I can run the video find directly through QuickTime.  I have been serching for an asnwer for awhile now.  I have the most recent version of iTunes 10.5.  Help would be appreciated.  System specs below.
    CPU: Intel i7 2600
    Graphics Card: ATI 6990
    Motherboard: Intel DZ68DB
    RAM: 8GB DDR3 Ripjaw
    OS: Windows 7 Professional 64x
    The video usually begins normal, but within seconds the audio and the video drifts out of sync.  Pausing and playing the video helped for a few seconds, but it quickly drifs out again.  Help would be much appreciated.  Thanks!

    Im having this problem too,  upgraded my laptop to windows 8 and the audio and video sync makes movies and tv shows unwatchable. I have tried re-installing itunes but this made no difference

  • Comments on the 285GTX and the Limiter

    I ask if you have the time and are willing, please post your experiences or feedback with the 285GTX and the limiter whether positive or negative. I will forward to the appropriate parties This is not a official Adobe request or anything incase any are wondering.

    Thank you for the feedback. The limiter comes into play on the 285GTX when you add effects to a 4th layer or higher video and leave the tracks active. The yellow line above your sequence will turn red indicating that the effects for that layer will be processed by the CPU and you will have to render out those effects to export them with the sequence. If you monitor your CPU usage once you add effects to a 4th layer or higher, you will see it increases far more for that layer than it did for the previous 3 layers. Basically what the limiter does is force you to render your timeline if you have effects beyond the first 3 layers and increases CPU usage allot more for any effects beyond the 3rd layer. This requires those projects to take more time due to rendering the effects on those layers. For many that may not be an issue but for those with tight deadlines it will be. If you monitor your GPU usage while playing back 3 layers with several effects, you will see the 285GTX is not being pushed hard with just 3 layers. It is not based on the codec of the material. AVCHD and R3D had the same limitation with regards to effects processing and the limiter.
    My request for feedback is to determine if most people are barely pushing their 285GTX cards with 3 layers. Also it is to determine if you would purchase a Quadro card due to the limiter.I will forward this information to our contacts at Nvidia and Adobe to show them the limiter is completely uncalled for. That is the only way we are going to get this changed now or with the Fermi Geforce cards.

  • Traditional TFT LCD of the N900 and the new SLCD !

    Can anyone here explain me is S-LCD the next generation of the TFT LCD does it offer a dramatic improvement in display ( I am not really looking out for a very technical explanation just need to know from a user perspective) is it great fun watching in SLCD compared to the traditional TFT LCD display that the N900 has. if yes, How much the difference between the TFT LCD of the N900 and SLCD would be ?

    @CP...
    such a nice post...needs to be said again without needing to re-finger it in!    +1 m8..
    cpitchford wrote:I meant it's not the right place to ask as there are other forums that seem to specialise in talking about LCD panels
    So I really dont know what you mean when you say the resolution is the same between OLED and SLCD...It is not the same
    Huh??
    OLED and SLCD do not define resolution.. you're wrong for thinking that.. They are types of displays.. OLED is not fixed to 800x480, SLCD is not fixed to 960x640.. Its like saying diesel engines are 2liter where as petrol engines are 1.5....
    OK.. The HTC Desire (and google Nexus one) originally shipped with OLED displays..
    Due to shortages of OLED panels, HTC decided to change the display type to the more commonly available LCD.. Now HTC Desires are LCD..
    However..
    The resolution is exactly the same.. they are both still 800x480.. The type of screen does NOT dictate the resolution of the screen..
    You could have a crud low resoltion 640x360 OLED screen on the Nokia N8, and a high res 800x480 LCD screen on the N900.. both are 3.5" screens!
    As for the difference in visual quality of OLED and LCD:
    OLED screens are tiny light bulbs.. each pixel produces its own light (actually multiple red, green blue lights per pixel)
    LCD, however works using filters.. There is a white light  behind the screen, and the LCD lets some of the light through coloured "holes".. That is the MAIN difference between LCD and OLED..
    All OLED displays work like this and all LCD displays work like this..
    So, because it is easier to make a filter of a certain colour, LCD screens can often produce more realistic colours..
    OLED displays however, have the ability to go completely dark.. Look a black screen on a LCD display (like your phone) it still glows.. thats because the LCD cannot filter out ALL of the white back light.. it just filters out most..
    OLEDs, however, when they are black they are OFF meaning they produce ZERO light!!
    LCDs range from blight to dim.. whereas OLED range from even brighter to totally black..
    This is called the contrast ratio..
    It also might mean OLED displays seem "saturated" the colours are too vibrant..
    Now, that's OLED v LCD
    Going back to your question in your second post..
    The Desire PS IPS LCD display (that's the S-LCD display if you want a brand name) is technically a lower definition because the pixels are larger when compared to the N900..
    The colour reproduction (how accurate the colours are) and the contrast ratios however will be BETTER than the N900 because the Desire can display 16Million colours rather than 65thousand.. and the LCD technology is a generation newer than that used in the N900...
    The N900 screen, although high resolution for its size, is fairly old tech..

Maybe you are looking for

  • App store wont let me install "Pages" onto my macbook pro

    I brought an app recently from the app store called "pages". I am trying to install this app onto my MacBook Pro but whenever i try and install it, it comes up as "An error as occurred" How do i fix this?

  • Basics of wireless printing? ABS required?

    Can someone direct me to the Apple doc for this topic? One I found was for Tiger, I use Leopard now. My specific questions are, Can this be done through a wireless router other than Apple's Airport Base Station series? (we tried both Extreme and Expr

  • Seperate my midi keyboard with two or more software instruments

    How can I seperate my midi keyboard with two or more software instruments?

  • Variable speed transitions?

    Hi, I want to set up a transition (cube spin in this case) where i can vary the speed of the transition similar to doing time remap but on the transition. I'd like it to get progressivley faster, like a tween in flash any ideas? thanks, andy g5   Mac

  • Where is the Xcode 4.0.1 update ? Download not found !!

    Hi, I have finished the Xcode update to 4.0.1. Download of 4,5GB has finished successfully through App Store but I cannot find any file anywhere. App Store does not show any update pending to install and does not offer the option to download it again