I'm being stupid, again. Sum & Count, together

Hi-
I thought that this should be easy and I was able to do this...nope.
i need to sum a value for each distinct count.  Having read a few post, i think i need an over() function.
select distinct
    [Training Title],
    [Training Type],
    count(CASE WHEN [user id] IS NULL THEN 0 ELSE 1 END) as 'Number',
    sum(cast([training hours] as float)) as 'Total Hours',
    count([training object id]) as 'Offerings'
-- this is duping, think i need an count([training object id]) over(PARTITION BY [TRAINING TITLE] )
from q2_2014
where [training type] = 'session'
group by
    [Training Title],
    [Training Type]

data:
Training Title
user id
training hours
training object id
crs1
a1
0.25
id-1
crs1
b1
0.25
id-1
crs1
c1
0.25
id-2
crs1
d1
0.25
id-2
csr2
a1
0.25
id-1a
crs2
b1
0.25
id-1b
crs3
a1
0.25
id-1
results:
Training Tile
Count Users
Total Hours
Number of Offerings
crs1
4
1
2
crs2
2
0.5
2
crs3
1
0.25
1

Similar Messages

  • Get Column sum, count in sql developer

    Dear All seniors,
    I need help in oracle sql developer that after select statement when we got our result in below rows and coloums,
    then how to get its sum, count, etc.
    as in pl sql developer we simply right click at a column and then click on the desired function.
    is this facility also have in sql developer?

    We've kicked around the idea of doing this for awhile. I believe there's already an item in the Exchange if you want to up vote it. The challenge being if it's a result set which hasn't been fully fetched, doing an aggregate would require one - and that could be costly. Of course folks live in the grids so I see the value in this type of feature as well.
    As a workaround, you could of course export your data to CSV or XLS and do the calculations in your favorite spreadsheet software.

  • I brought hoyle slots it did not down correctly i want to reload without being billed again

    how can i reload an app that did not load correctly without being charge again

    It should be on your "Purchases" pane in the Mac App store (if that is where you bought it from). There should be a  [ Download ] button there to download it again.

  • I was charged for a movie that never was downloaded, i asked for it but the conection was too slow and I never was able to have the movie that i asked for...how can i get it without being charged again, who could remove the chage from my Crecit card?

    i was charged for a movie that never was downloaded, i asked for it but the conection was too slow and I never was able to have the movie that i asked for...how can i get it without being charged again, who could remove the chage from my Crecit card?

    You may not be able to get a refund, since the terms of sale for the iTunes Store state that all sales are final. You can contact the iTunes Store, explain the reason for your request, and ask, though:
    http://www.apple.com/support/itunes/contact.html
    It's possible they'll make an exception for you, particularly if the problem was on their end preventing the movie from downloading in a reasonable time.
    Good luck.

  • Hum.... being stupid? can't restart from CD

    right... I think that I am being stupid...
    Had a mac for a few years now, and there I thought that restarting from the disc would be easy....
    I get this weird error on my macbook:
    Volume Header needs minor repair
    The volume Macintosh HD needs to be repaired.
    Error: The underlying task reported failure on exit
    So I am trying to reboot from the disc to repair permissions on my disc....
    But I cant!!! insert the disc, restart from disc, holding c or changing the startup disc, and OSX keeps on starting up... can't get it to reboot from it..
    HA!!!!!!!
    Yes I could purchase DISKWARRIOR, but I could also try and save $90 (ish) , and I would love to know what I am doing wrong here...
    Just don't get it....
    Anyone?

    Hi, i thought that I replied this morning, but obviously I hadnt.
    Put the disc in, restart the machine holding C until the apple logo comes up and the little circle goes around, release the c key, machine takes some little time, and the disc is spinning, so I am guessing that it is starting from the disc, blue screen and Mac OSX starting with the progress bar, then that goes off, and OSX installer kicks in, asking me for language to use, and then the install wizzard. and thats it....
    If I try and go through the wizard, it falls apart telling me that it can't install OSX on this volume (so it must be started from the disc), then prompts me with a start up disc, I can clearly see both my internal drive and the cd in the list, I choose the disc, click restarts and it does the same over and over... keeps going back to the installer...
    G5, D2.0, 5G-ram, 1TB storage, 30''display, macbook   Mac OS X (10.4.9)  

  • HT201209 I'm new to this an yesterday I bought 65$ worth of iTunes music using a iTunes gift card. Then I got these emails saying I am being billed again????? What do I do???? I'm very frustrated with this. Please help me

    yesterday I bought 65$ worth of iTunes music using a iTunes gift card. Then I got these emails saying I am being billed again????? What do I do???? I'm very frustrated with this. Please help me

    What e-mail are you talking about?
    What exactly did it say?
    Are you sure that the e-mail was not your receipt?

  • Profitability segment being derived again-in MIRO for Subsequent Credit

    HI All,
    Need help for below Warning message i could not able to post MIRO for subsequesnt Credit.
    Profitability segment being derived again
    Message no. KI350Diagnosis
    You have assigned an profitability segment with the auxiliary account assignment  PrCtr 5300MN0000. The profitability segment, however, contains the characteristics  PrCtr 5300MN0000.
    System Response
    The characteristics of the profitability segment and the auxiliary account assignments must not contain different values. In particular, the profit center and business area must match.

    Hi
    As Waman said, there will be some substitution which is forcing PC into the line item.. Else, this problem wont occur...
    If possble, switch off your subst and Post this entry..... See if it goes through
    Br, Ajay M

  • HUM and SUM implemented together

    Can HUM and SUM implemented together  , if so what are the advantages and the disadvantages .
    can some one help me on this .
    thanks ,
    ksr.

    Hi,
    it is possible to use handling unit management together with warehouse management. You activate handling unit management independent from storage unit management. Only in case if storage location is full-WM- AND HU-managed, the storage unit management is always active and HU numbers are taken over as SU numbers. In all other cases HUM and SUM are independent from each other and number ranges must be set a way that they are not overlapping.                                                                               
    Regards,
    Ely

  • One day, being stupid, I used my Comcast email account to be my backup email address, just in case I forgot my security questions. Well I did. The email I was using was deleted and I can't get the answers. How do I fix it?

    One day, being stupid, I used my Comcasst email account to be my backup email account in case I forgot my security questions. Well I did. I did not know that Comcast deleted your email when you disconnected with their service. When I ask for my security answers, it sends it to that email. How do I fix what I've done? Because now, I can't download apps that I have to pay for.

    The Best Alternatives for Security Questions and Rescue Mail
    1.  Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
    2.  Call Apple Support in your country: Customer Service: Contact Apple support.
    3.  Rescue email address and how to reset Apple ID security questions.
    An alternative to using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • I purchased tv episodes on apple tv and had to delete the episodes to make room for me to be able to download other stuff.  Now I want to watch those episodes I already paid for again.  How do I re-download those episodes without being charged again?

    I purchased tv episodes on apple tv and had to delete the episodes to make room for me to be able to download other stuff.  Now I want to watch those episodes I already paid for again.  How do I re-download those episodes to my apple tv without being charged again?

    Welcome to the Apple community.
    Assuming you are in a location that supports re-downloading of TV shows, you can download any purchased TV shows from the purchased option in the quick links section in the top right-hand corner of iTunes on your computer.

  • I had an App on MacBook Air which would cause my computer to be locked. I delted it and reinstalled the App again from the AppStore. Now I am being charged again for the same App. How can I correct this issue and get refund for the double billing?

    I had an App on MacBook Air which would cause my computer to be locked. I delted it and reinstalled the App again from the AppStore. Now I am being charged again for the same App. How can I correct this issue and get refund for the double billing?

    You can't gift it, gifting can only be done from within the store, not from within your library.
    Puchases are considered final but you can try the 'report a problem' link to contact iTunes Support and see if they will refund or credit you : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Help on flashing Bios, b4 I do something stupid again...

    I have the MSI845pe max2 , but the oldest version, version 1.0
    when i look for bios versions on the site i c this:
    http://www.msi.com.tw/program/support/bios/bos/spt_bos_detail.php?UID=401%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20&NAME=MS-6704%20Ver2.0
    the bios below (3.0) says: cant be used on the 1.0 version
    but can i flash the bios above then (3.1) ?
    help me b4 i do something stupid (again)

    Use only the bios for PCB1.0 here

  • HT201272 some games already purchased, wont play like skies of glorys and red tails, and being billed again for items already purchased

    why are some games like skies of glory and red tails will download then start with the titles but wont play, they played before the last update IO 6. I have deleted them and reloaded them, still wont play.
    and when restoring previous purchased items I am being billed again!!! seriously peed off!
    any clues

    I know this stuff is 3 months old but I just got mine and hadn't yet used the pin function so now I know.
    I hope you are right Nancy that it will have updates, but I really doubt it. This is the norm for Microsoft when stuff they put out bombs. Dish Network had a DVR receiver many years ago that had Microsoft software installed and it was buggy to say the least. They updated it a few times but then abandon it. For a few years Microsoft wouldn't release the code to Dish Network to allow DN to fix the bugs. It was a real "Hate Microsoft" time for those users. DN had to put out their own coded DVR receivers and let the Microsoft ones die.
    I think VZ made a deal with MS and removed the stuff MS wasn't supporting. Then VZ put them out without needing a data package to unload them.

  • HT203167 I downloaded a ringtone last week for my iphone5 and it was active on my phone until I did a sync on the weekend with my laptop and now I find the ringtone has disappeared how do I reload it without being charged again?  I still have the tax invo

    I downloaded a ringtone last week for my iphone5 and it was active on my phone until I did a sync on the weekend with my laptop and now I find the ringtone has disappeared how do I reload it without being charged again?  I still have the tax invoice.

    Ringtones are currently a one-time only download, but if it's not on your phone and it hasn't copied over to the Tones section of your computer's iTunes library then you can try contacting iTunes support and see if they will grant you a re-download : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • How to print SUM & COUNT at the end of the XML template

    Hello,
    I am generating a payment file in oracle Payments and at the end of the file, I would also like to add a trailer record with sum of the payments and number of payments. Can anyone have any suggestions on having a trailer record with SUM & COUNT.
    Thanks,

    You can use,
    COUNT and SUM of the column to get those values.
    In extext, add a new record and add these function on columns.

Maybe you are looking for