get the maximum number for each group

Hi, I am a newbie and work on a project for school. I worked this problem for a few days and made a bit of progress.
I have two tables, student and register for a database of the College. I need to show students that have the most entries into each large. So far, I have:

WITH COUNT_Q AS
(
SELECT B.SSN, B.MAJOR, COUNT (A.CLASS_NO) AS COUNTCLASS
TO REGISTER A, STUDENT B
WHERE A.SSN = B.SSN
B.SSN GROUP, B.MAJOR
)

SELECT MAX (COUNTCLASS), MAJOR
OF COUNT_Q
GROUP BY MAJOR
;

I get the correct results, but need to introduce the SSN and the Major of the studens. When I add in the SSN and major, as below, I get too many files.
WITH COUNT_Q AS
(
SELECT B.NAME, B.SSN, B.MAJOR, COUNT (A.SSN) AS COUNTCLASS
TO REGISTER A, STUDENT B
WHERE A.SSN = B.SSN
B.NAME, B.SSN, B.MAJOR GROUP
)

SELECT *.
OF COUNT_Q
WHERE (COUNTCLASS) IN (SELECT MAX (COUNTCLASS)
OF COUNT_Q
GROUP BY MAJOR
)
;

Can someone point me in the right direction?
SELECT  B.NAME,
        B.SSN,
        B.MAJOR
  FROM  (
         SELECT  B.NAME,
                 B.SSN,
                 B.MAJOR,
                 COUNT(A.CLASS_NO) SSN_MAJOR_COUNTCLASS
                 DENSE_RANK() OVER(PARTITION BY MAJOR ORDER BY COUNT(A.CLASS_NO) DESC) RNK
           FROM  ENROLL A,
                 STUDENT B
           WHERE A.SSN = B.SSN
           GROUP BY B.NAME,
                    B.SSN,
                    B.MAJOR
        )
  WHERE RNK = 1
/

SY.

Published by: Solomon Yakobson, March 27, 2011 18:53

Tags: Database

Similar Questions

  • Export the configuration information for each group

    How to export the configuration information for each group? (I want to see the information that this group has read or write access to the cube XXXXX)

    By LCM, I was able to export information on groups and users. But no information about its commissioning. can any body tell me how can I get the configuration of shared services information

    We have a utility to do this, or can we get this information using LCM?

    Any information about him will be useful

    Thank you

    The commissioning is under Application groups > Foundation > Shared Services > native Directory > assigned roles > then choose the product / app

    There is a utility command line available if you want to automate the process of execution of export - Oracle Hyperion Enterprise Performance Management System Lifecycle Management Guide, you create the definition of migration file but which can be done by running an export.

    See you soon

    John

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

  • Adding column which gives the serial number for each line in the Bulletin Board

    I use the update version 2 Jdev 11 g.
    I'm the filling of all employees from the emp table ADF table.
    My requirement is to add a column more as the first column and header line which displays the serial number for each serial number of row.the is not available in the table emp in database .i want to generate it dynamically when the data are filled in to ADF table.i don't want not to use the method to get the SQL query rownum. I want to get custom code (in the Managed Bean) or set all of the properties in the subject entity or any other object.

    Published by: sj0609 on September 8, 2009 09:43

    Hello

    Give an id to the table (say 'currRow') varStatus property. Add a column to the table (for example with a text output), then set it to the value of the output text #{currRow.index}.

    Arun-

  • How to get the maximum number of days in a month?

    How to get the maximum number of days in a month?

    I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.

    How can I get it?

    Please help me. and thanks in advance... []

    NET. RIM. Device.API.util
    Class DateTimeUtilities

    getNumberOfDaysInMonth (int month, int year)
    Returns the number of days in the specified month

    It took me like 10 seconds to find it in the API, I guess you spent more time writing the post...

  • How can I get the serial number for Adobe Acrobat XI?

    How can I get the serial number for Adobe Acrobat XI? I have download adobe for free on my laptop dell Inspiron 64 bit Web site.

    It is not free. It is an old version and is no longer sold. You can buy or subscribe to the current version of Acrobat Pro DC.

  • I have Adobe Creative Suite 6 Design Standard in the Windows Version, how do I get the serial number for a MAC Version?

    Hello

    I have Adobe Creative Suite 6 Design Standard in the Windows Version, how do I get the serial number for a MAC Version?


    I downloaded Adobe Creative Suite 6 in my Mac, but it does not accept the serial number.

    What should I do?

    Thanks for any help.

    Best regards


    Digga515

    Product change or the language platform - they might still be offering this for CS6, although it gets old...

    You can exchange languages/platforms for a newer version product if you follow the instructions on the following link:

    l http://helpx.adobe.com/x-productkb/Policy-Pricing/Order-Product-Platform-Language-swap.htm

    You can exchange only once and lose the Windows license, when you switch to the Mac

  • How can I get the serial number for update for first pro cs4 4.2.1, one provided with the product does not work.

    How can I get the serial number for update for first pro cs4 4.2.1, one provided with the product does not work?

    You don't need a serial nr for updating a program

    You need the original CS4.0. install and add the series nr. to get the program to work.

    Now you can update to 4.2.1

  • Recently, I'm subscribed to Acrobat XI after the test expired, but when I went to turn it on I was asked for the serial number. I don't have the order number on the invoice. How can I get the serial number for the trial software that is on my computer?

    Recently, I'm subscribed to Acrobat XI after the test expired, but when I went to turn it on I was asked for the serial number. I don't have the order number on the invoice. How can I get the serial number for the trial software that is on my computer?

    Hi Kenneth,

    Subscription does not have any serial number. Please use your Adobe ID to update the licensed software.

    Kind regards

    Rave

  • How can I get the serial number for my SetupUpdates12 I have the redemption code

    How can I get the serial number for my SetupUpdates12 I have the redemption code

    Hi ylee0y0te,

    Please follow the steps detailed here.

    1. http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

    2.http://helpx.adobe.com/x-productkb/global/find-serial-number-student-teacher.html

    3.http://helpx.adobe.com/x-productkb/global/find-serial-number.html

    Hope this helps you.

    Kind regards

    Baudier

  • How can I get the serial number. for an edition of the education of cs6

    How can I get the serial number. for an edition of the education of cs6.  I try to save but not obvious how?

    Have you tried http://www.adobe.com/go/eduverify?

  • get the serial number for photoshop just in premium creative suite to reinstall photoshop 3

    I reinstall my photoshop 3 on my new mac, but need the individual serial numbers of my old creative suite for photoshop until I can reinstall or upgrade. I still have got to Adobe before each upgrade.

    There is no separate serial number. You need the serial number for CS3. You should get it from your records, you can't count on Adobe to remember forever. If the chances of CS3 running in the latest Mac OS are very small. If you upgrade the Mac you need a budget for upgrading applications. Photoshop is now subscription only.

  • How to get the maximum number of iterations in the property of TS

    I was put the loopType from one step to the count of success/failure. For example "stop after 1 iterations pass or a maximum of 3 iterations. The maximum iteration is 3. What my qustion is how to get the maximum iteration of TS property by codes of trial during the race. Thank you very much!

    Corey Chen

    The OPPO test developer

    Hello

    It may be a hack, but RunState.Step.LoopWhileExpression has information.  It will return a string like: "RunState.LoopIndex."< 69="" &&="" runstate.loopnumpassed=""><>

  • How can I get the phone number for the Activation of Microsoft Center in Washington State?

    I can't use the normal process to obtain the phone number for the product activation because Windows 7 says "Windows is activated". How can I contact an Activation Center to get this problem fixed. Apparently, it is not enabled because I can't use Microsoft Help and support center. HD & S centre will not accept my product ID. I used the Windows Anytime Upgrade process for Windows 7 Edition Home Premium to Windows 7 Professional. After the installation process, I activated Windows and it works beautifully.

    I am trying to establish the Windows XP Mode in Windows Virtual Machine and have hit a wall. I downloaded the three pieces but keep being told to download it again when I click on Windows XP Mode in the start menu.

    I tried to get the Support of Microsoft but get stopped on step 2 when the Microsoft operating systems will not accept my product ID of Windows 7.

    1. click on start and in the search for box type: slui.exe 4
    2. press enter on your keyboard
    3. Select your country.
    4. Select the telephone activation option and brace yourself for a real person.

    Carey Frisch

  • Need to get the serial number for the product

    In 2009, I bought a licensed education of Adobe Creative Suite 4 Web Premium version that I installed on a MacBook Pro.

    The hard drive on this computer failed and the software must be reinstalled.

    The 'Product Code' for the software is "WEB PREMIUM CTO REMOVED.

    The products cannot be activated without the "serial number", which was provided by Adobe After further evidence was provided.

    The serial number has been moved.

    When I run an application in the suite, I get the following message:

    "Licensing for this product has stopped working" and displays the following error code: ' error: 150:30 '.

    Anyone know how to contact Adobe technical support for re - get the serial number?

    Lost information - response #1 in https://forums.adobe.com/thread/2008767

    150:30 trouble https://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html license error

    As far as I know, Adobe keeps no record of serial... numbers so you have registered (1st link above)

  • How can I get the serial number for Adobe XI who bought from Amazon, more than two weeks ago?

    I'm trying to get the serial number so that I can have the permanent version of the Adobe XI that I bought on Amazon.  Does anyone know how Adobe warns a buyer for this info?  I bought the software for download don't have is not a box.

    Please visit: http://helpx.adobe.com/x-productkb/policy-pricing/education-faq.html

    Adobe student & teacher Editions require that you check your academic proof after you get the software in order to obtain your serial number. The instructions for this verification process are inside the box. Adobe teacher & editions can be installed and used immediately for thirty days before a serial number is required.

    You will need to go to the site Adobe Student & Teacher Edition eligibility verification listed in the instructions, enter your product code (which is located at the top of the notice), enter your details and provide academic proof. Once your academic status has been verified, you will be sent a serial number. This process can take 1 to 3 days, but you can still run a trial of the software while you wait.*

    If you want to check the status of your application, click on the "Check state" link on the left side of the Web page. If you have any questions about this process, click on the link "Contact us" on the left side of the Web page and fill out the form to contact us at the bottom of the page.

Maybe you are looking for